Add #[wasm_bindgen(start)], plugins to webpack config, Update deps

This commit is contained in:
Daniel Schindler 2018-11-30 17:42:36 +01:00
parent 89e245bddf
commit caac2eba53
5 changed files with 20 additions and 5 deletions

View File

@ -1,3 +1,6 @@
target/
todomvc.js
dist/
_site/
todomvc*
*.swp

View File

@ -13,10 +13,10 @@ askama = "0.7.2"
js-sys = "0.3.5"
wasm-bindgen = "0.2.28"
askama = "0.7.2"
console_error_panic_hook = "0.1"
console_error_panic_hook = "0.1.5"
[dependencies.web-sys]
version = "0.3.4"
version = "0.3.5"
features = [
'console',
'CssStyleDeclaration',

View File

@ -37,7 +37,6 @@
<p>Written by <a href="http://twitter.com/KingstonTime/">Jonathan Kingston</a></p>
<p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
</footer>
<link rel="stylesheet" href="./base.css">
<script src='./index.js'></script>
</body>
</html>

View File

@ -63,7 +63,7 @@ fn app(name: &str) {
}
/// Entry point into the program from JavaScript
#[wasm_bindgen]
#[wasm_bindgen(start)]
pub fn run() {
console_error_panic_hook::set_once();
app("todos-wasmbindgen");

View 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,16 @@ module.exports = {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
},
plugins: [
new HtmlWebpackPlugin({
template: "index.html"
}),
// 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'
};