| 1 |
const path = require('path'); |
| 2 |
const HtmlWebpackPlugin = require('html-webpack-plugin'); |
| 3 |
const webpack = require('webpack'); |
| 4 |
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin"); |
| 5 |
|
| 6 |
module.exports = { |
| 7 |
entry: './index.js', |
| 8 |
output: { |
| 9 |
path: path.resolve(__dirname, 'dist'), |
| 10 |
filename: 'index.js', |
| 11 |
}, |
| 12 |
plugins: [ |
| 13 |
new HtmlWebpackPlugin({ |
| 14 |
template: 'index.html' |
| 15 |
}), |
| 16 |
new WasmPackPlugin({ |
| 17 |
crateDirectory: path.resolve(__dirname, "crate") |
| 18 |
}), |
| 19 |
// Have this example work in Edge which doesn't ship `TextEncoder` or |
| 20 |
// `TextDecoder` at this time. |
| 21 |
new webpack.ProvidePlugin({ |
| 22 |
TextDecoder: ['text-encoding', 'TextDecoder'], |
| 23 |
TextEncoder: ['text-encoding', 'TextEncoder'] |
| 24 |
}) |
| 25 |
], |
| 26 |
mode: 'development', |
| 27 |
experiments: { |
| 28 |
asyncWebAssembly: true |
| 29 |
} |
| 30 |
}; |