wasm: Add request body in the form of Bytes (#696)

* Add body bytes

* Add example and header creation code
This commit is contained in:
John Gallagher
2019-11-04 12:17:05 -05:00
committed by Sean McArthur
parent b24b0be461
commit f6f81f9cc1
11 changed files with 6306 additions and 9 deletions

View File

@@ -0,0 +1,25 @@
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(),
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'
};