mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-13 13:01:22 +00:00
.cargo
ci
crates
examples
add
canvas
char
closures
console_log
dom
duck-typed-interfaces
fetch
guide-supported-types-examples
hello_world
import_js
julia_set
paint
performance
raytrace-parallel
request-animation-frame
todomvc
wasm-in-wasm
src
Cargo.toml
README.md
index.html
index.js
package.json
webpack.config.js
wasm2js
webaudio
webgl
without-a-bundler
without-a-bundler-no-modules
.gitignore
README.md
guide
releases
src
tests
.gitattributes
.gitignore
CHANGELOG.md
CONTRIBUTING.md
Cargo.toml
LICENSE-APACHE
LICENSE-MIT
README.md
azure-pipelines.yml
build.rs
package.json
publish.rs
This commit migrates all our examples to using `wasm-pack build` to compile their code and run `wasm-bindgen`. This should make it a bit easier to understand the examples as there's less to follow during the build step. Webpack projects are all using `@wasm-tool/wasm-pack-plugin` as well so the build step is simple `npm run serve`. Other examples which retain `build.sh` are just using `wasm-pack build` now
28 lines
833 B
JavaScript
28 lines
833 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'
|
|
};
|