mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-13 23:56:06 +00:00
commit
a9eb20b4dc
@ -3,10 +3,8 @@
|
|||||||
# For more comments about what's going on here, see the `hello_world` example
|
# For more comments about what's going on here, see the `hello_world` example
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
cd "$(dirname $0)"
|
|
||||||
|
|
||||||
cargo build --target wasm32-unknown-unknown
|
cargo build --target wasm32-unknown-unknown
|
||||||
|
|
||||||
cargo run --manifest-path ../../crates/cli/Cargo.toml \
|
cargo run --manifest-path ../../crates/cli/Cargo.toml \
|
||||||
--bin wasm-bindgen -- \
|
--bin wasm-bindgen -- \
|
||||||
../../target/wasm32-unknown-unknown/debug/todomvc.wasm --out-dir .
|
../../target/wasm32-unknown-unknown/debug/todomvc.wasm --out-dir .
|
||||||
|
@ -37,6 +37,5 @@
|
|||||||
<p>Written by <a href="http://twitter.com/KingstonTime/">Jonathan Kingston</a></p>
|
<p>Written by <a href="http://twitter.com/KingstonTime/">Jonathan Kingston</a></p>
|
||||||
<p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
|
<p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
|
||||||
</footer>
|
</footer>
|
||||||
<script src='./index.js'></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
import('./todomvc').then(todomvc => {
|
// For more comments about what's going on here, check out the `hello_world`
|
||||||
todomvc.run();
|
// example
|
||||||
});
|
import('./todomvc')
|
||||||
|
.catch(console.error);
|
||||||
|
@ -4,8 +4,9 @@
|
|||||||
"serve": "webpack-dev-server"
|
"serve": "webpack-dev-server"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"text-encoding": "^0.7.0",
|
"copy-webpack-plugin": "^4.6.0",
|
||||||
"html-webpack-plugin": "^3.2.0",
|
"html-webpack-plugin": "^3.2.0",
|
||||||
|
"text-encoding": "^0.7.0",
|
||||||
"webpack": "^4.11.1",
|
"webpack": "^4.11.1",
|
||||||
"webpack-cli": "^3.1.1",
|
"webpack-cli": "^3.1.1",
|
||||||
"webpack-dev-server": "^3.1.0"
|
"webpack-dev-server": "^3.1.0"
|
||||||
|
@ -64,7 +64,9 @@ fn app(name: &str) {
|
|||||||
|
|
||||||
/// Entry point into the program from JavaScript
|
/// Entry point into the program from JavaScript
|
||||||
#[wasm_bindgen(start)]
|
#[wasm_bindgen(start)]
|
||||||
pub fn run() {
|
pub fn run() -> Result<(), JsValue> {
|
||||||
console_error_panic_hook::set_once();
|
console_error_panic_hook::set_once();
|
||||||
app("todos-wasmbindgen");
|
app("todos-wasmbindgen");
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -12,6 +13,10 @@ module.exports = {
|
|||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
template: "index.html"
|
template: "index.html"
|
||||||
}),
|
}),
|
||||||
|
new CopyWebpackPlugin([
|
||||||
|
{ from: 'index.css', to: 'index.css' },
|
||||||
|
]),
|
||||||
|
|
||||||
// Have this example work in Edge which doesn't ship `TextEncoder` or
|
// Have this example work in Edge which doesn't ship `TextEncoder` or
|
||||||
// `TextDecoder` at this time.
|
// `TextDecoder` at this time.
|
||||||
new webpack.ProvidePlugin({
|
new webpack.ProvidePlugin({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user