mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-12 12:31:22 +00:00
Fix polyfill of TextEncoder
and TextDecoder
This commit does a few things, including: * Fixing the generated JS of `wasm-bindgen` to allow polyfills to work. (a minor tweak of the generated JS) * All examples are updated to include a Webpack-specific polyfill for these two types to get examples working in Edge. * A new page has been added to the guide about supported browsers. This mentions known caveats like IE 11 requiring `wasm2js` as well as documenting some `TextEncoder` and `TextDecoder` workarounds for Edge. Closes #895
This commit is contained in:
@ -1,8 +1,11 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "webpack",
|
||||
"serve": "webpack-dev-server"
|
||||
},
|
||||
"devDependencies": {
|
||||
"text-encoding": "^0.7.0",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"webpack": "^4.11.1",
|
||||
"webpack-cli": "^3.1.1",
|
||||
"webpack-dev-server": "^3.1.0"
|
||||
|
0
examples/duck-typed-interfaces/src/lib.rs
Executable file → Normal file
0
examples/duck-typed-interfaces/src/lib.rs
Executable file → Normal file
@ -1,4 +1,6 @@
|
||||
const path = require('path');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const webpack = require('webpack');
|
||||
|
||||
module.exports = {
|
||||
entry: './index.js',
|
||||
@ -6,5 +8,14 @@ module.exports = {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'index.js',
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin(),
|
||||
// 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'
|
||||
};
|
||||
|
Reference in New Issue
Block a user