2020-05-11 19:37:57 +00:00
|
|
|
/* eslint-env node */
|
|
|
|
|
2021-02-17 04:39:46 +00:00
|
|
|
const path = require("path");
|
2021-03-04 20:59:10 +00:00
|
|
|
const CopyPlugin = require("copy-webpack-plugin");
|
2019-05-08 18:27:07 +00:00
|
|
|
|
2021-07-16 21:55:53 +00:00
|
|
|
module.exports = (_env, _argv) => {
|
|
|
|
const mode = process.env.NODE_ENV || "production";
|
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 {
|
2021-02-17 04:39:46 +00:00
|
|
|
mode,
|
2021-04-21 18:56:38 +00:00
|
|
|
entry: "./www/index.js",
|
2020-05-12 22:24:41 +00:00
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, "dist"),
|
|
|
|
filename: "index.js",
|
2021-02-17 04:39:46 +00:00
|
|
|
publicPath: "",
|
2021-03-03 14:19:46 +00:00
|
|
|
clean: true,
|
2020-05-12 22:24:41 +00:00
|
|
|
},
|
2021-01-10 03:36:05 +00:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.css$/i,
|
|
|
|
use: ["style-loader", "css-loader"],
|
|
|
|
},
|
2021-07-27 05:37:09 +00:00
|
|
|
{
|
|
|
|
test: /\.wasm$/i,
|
|
|
|
type: "asset/resource",
|
|
|
|
},
|
2021-01-10 03:36:05 +00:00
|
|
|
],
|
|
|
|
},
|
2021-02-17 04:39:46 +00:00
|
|
|
devtool: "source-map",
|
|
|
|
plugins: [
|
2021-03-04 20:59:10 +00:00
|
|
|
new CopyPlugin({
|
2021-02-17 04:39:46 +00:00
|
|
|
patterns: [
|
2021-02-21 20:52:04 +00:00
|
|
|
{ from: path.resolve(__dirname, "www/index.html") },
|
2021-02-17 04:39:46 +00:00
|
|
|
{ from: "LICENSE*" },
|
|
|
|
{ from: "README.md" },
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
],
|
2020-05-12 22:24:41 +00:00
|
|
|
};
|
2019-05-08 18:27:07 +00:00
|
|
|
};
|