-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
28 lines (26 loc) · 922 Bytes
/
webpack.config.js
File metadata and controls
28 lines (26 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const webpack = require("webpack");
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
module.exports = (env, args) => {
const isProductionMode = (args.mode === "production");
return {
entry: "./src/app.js",
output: {
path: path.resolve(__dirname, "dist"),
filename: isProductionMode ? "[name].[contenthash].js" : "[name].[hash].js",
},
plugins: [
new HtmlWebpackPlugin({
template: "public/index.html"
}),
new WasmPackPlugin({
crateDirectory: path.resolve("__dirname", ".")
}),
new webpack.ProvidePlugin({
TextDecoder: ["text-encoding", "TextDecoder"],
TextEncoder: ["text-encoding", "TextEncoder"]
})
]
};
}