以下のようなエラーが出たとき、
Module parse failed: Unexpected character '' (1:0)
The module seem to be a WebAssembly module, but module is not flagged as WebAssembly module for webpack.
BREAKING CHANGE: Since webpack 5 WebAssembly is not enabled by default and flagged as experimental feature.
You need to enable one of the WebAssembly experiments via 'experiments.asyncWebAssembly: true' (based on async modules) or 'experiments.syncWebAssembly: true' (like webpack 4, deprecated).
エラー文内にも記載がありますが、以下の記載(2〜4行目)をwebpack.config.js
に追記してあげると良い。
module.exports = {
experiments: {
asyncWebAssembly: true,
},
resolve: {
extensions: ['.js', '.wasm'],
},
plugins: [
new HtmlWebpackPlugin(),
],
}