Skip to content

Commit

Permalink
CHANGE: Updated webpack config to work with emscripten
Browse files Browse the repository at this point in the history
The default webpack options don't play with wasm32-emscripten.
Refer to the open issue in: webpack/webpack#7352
  • Loading branch information
Conzel committed Aug 11, 2021
1 parent 071a3e8 commit abbb0b2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions wasm/www/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const CopyWebpackPlugin = require("copy-webpack-plugin");
const webpack = require("webpack");
const path = require('path');

module.exports = {
Expand All @@ -11,4 +12,22 @@ module.exports = {
plugins: [
new CopyWebpackPlugin(['index.html'])
],
// refer to https://github.com/webpack/webpack/issues/7352
// Hack to make it work with emscripten-wasm
node: {
"fs": "empty" // ← !!
},
module: {
rules: [
/* ... */
{
test: /fibonacci\.wasm$/,
type: "javascript/auto", // ← !!
loader: "file-loader",
options: {
publicPath: "dist/"
}
}
]
},
};

0 comments on commit abbb0b2

Please sign in to comment.