mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-03 16:12:29 +03:00
2ccdbd9337
* Upgraded the webpack examples' npm dependencies which (among other things) upgrades them to webpack 5 For the weather_report, had to choose the syncWebAssembly experiment, whereas the rest works fine with asyncWebAssembly * Fix the weather report example compilation by adding it to the main workspace. This currently fails with: error: current package believes it's in a workspace when it's not: current: <project-root>/examples/weather_report/Cargo.toml workspace: <project-root>/Cargo.toml * Fix the build of the webxr example with webpack 5 * run cargo fmt
31 lines
889 B
JavaScript
31 lines
889 B
JavaScript
const path = require('path');
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
const webpack = require('webpack');
|
|
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
|
|
|
|
module.exports = {
|
|
entry: './index.js',
|
|
output: {
|
|
path: path.resolve(__dirname, 'dist'),
|
|
filename: 'index.js',
|
|
},
|
|
plugins: [
|
|
new HtmlWebpackPlugin({
|
|
template: 'index.html'
|
|
}),
|
|
new WasmPackPlugin({
|
|
crateDirectory: path.resolve(__dirname, ".")
|
|
}),
|
|
// Have this example work in Edge which doesn't ship `TextEncoder` or
|
|
// `TextDecoder` at this time.
|
|
new webpack.ProvidePlugin({
|
|
TextDecoder: ['text-encoding', 'TextDecoder'],
|
|
TextEncoder: ['text-encoding', 'TextEncoder']
|
|
})
|
|
],
|
|
mode: 'development',
|
|
experiments: {
|
|
asyncWebAssembly: true
|
|
}
|
|
};
|