2020-05-11 19:37:57 +00:00
|
|
|
/* eslint-env node */
|
|
|
|
|
2020-05-12 22:24:41 +00:00
|
|
|
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
2019-05-08 18:27:07 +00:00
|
|
|
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
2020-05-12 22:24:41 +00:00
|
|
|
const path = require("path");
|
2019-05-08 18:27:07 +00:00
|
|
|
|
2019-07-25 07:58:34 +00:00
|
|
|
module.exports = (env, argv) => {
|
2020-05-12 22:24:41 +00:00
|
|
|
let mode = "production";
|
|
|
|
if (argv && argv.mode) {
|
|
|
|
mode = argv.mode;
|
|
|
|
}
|
2019-07-25 07:58:34 +00:00
|
|
|
|
2020-05-12 22:24:41 +00:00
|
|
|
console.log(`Building ${mode}...`);
|
2019-07-25 07:58:34 +00:00
|
|
|
|
2020-05-12 22:24:41 +00:00
|
|
|
return {
|
|
|
|
entry: path.resolve(__dirname, "www/index.js"),
|
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, "dist"),
|
|
|
|
filename: "index.js",
|
|
|
|
},
|
|
|
|
mode: mode,
|
|
|
|
plugins: [
|
|
|
|
new CleanWebpackPlugin(),
|
2020-05-21 06:34:14 +00:00
|
|
|
new CopyWebpackPlugin({
|
|
|
|
patterns: [
|
|
|
|
{
|
|
|
|
from: path.resolve(__dirname, "www/index.html"),
|
|
|
|
to: "index.html",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}),
|
2020-05-12 22:24:41 +00:00
|
|
|
],
|
|
|
|
};
|
2019-05-08 18:27:07 +00:00
|
|
|
};
|