Skip to content

Commit abbb0b2

Browse files
committed
CHANGE: Updated webpack config to work with emscripten
The default webpack options don't play with wasm32-emscripten. Refer to the open issue in: webpack/webpack#7352
1 parent 071a3e8 commit abbb0b2

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

wasm/www/webpack.config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const CopyWebpackPlugin = require("copy-webpack-plugin");
2+
const webpack = require("webpack");
23
const path = require('path');
34

45
module.exports = {
@@ -11,4 +12,22 @@ module.exports = {
1112
plugins: [
1213
new CopyWebpackPlugin(['index.html'])
1314
],
15+
// refer to https://github.com/webpack/webpack/issues/7352
16+
// Hack to make it work with emscripten-wasm
17+
node: {
18+
"fs": "empty" // ← !!
19+
},
20+
module: {
21+
rules: [
22+
/* ... */
23+
{
24+
test: /fibonacci\.wasm$/,
25+
type: "javascript/auto", // ← !!
26+
loader: "file-loader",
27+
options: {
28+
publicPath: "dist/"
29+
}
30+
}
31+
]
32+
},
1433
};

0 commit comments

Comments
 (0)