Skip to content
This repository has been archived by the owner on Dec 10, 2019. It is now read-only.

Commit

Permalink
Merge pull request #7 from kiskoza/master
Browse files Browse the repository at this point in the history
Make it work in Chrome #6
  • Loading branch information
yamafaktory authored Apr 20, 2018
2 parents b568ad6 + bc4d80c commit 1bbe42b
Show file tree
Hide file tree
Showing 4 changed files with 1,496 additions and 1,433 deletions.
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@
"eslint-plugin-standard": "3.0.1",
"husky": "0.14.3",
"lint-staged": "6.0.0",
"rust-native-wasm-loader": "0.2.2",
"rust-native-wasm-loader": "0.7.0",
"snazzy": "7.0.0",
"standard": "10.0.3",
"webpack": "v4.0.0-alpha.4",
"webpack-cli": "2.0.2",
"webpack-dev-server": "3.0.0-alpha6"
"wasm-loader": "^1.3.0",
"webpack": "v4.4.1",
"webpack-cli": "2.0.13",
"webpack-dev-server": "3.1.1"
},
"scripts": {
"build": "webpack",
Expand Down
9 changes: 6 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import('../src/lib.rs').then(wasm => {
console.log(wasm.add_one(22))
})
import loadWasm from './lib.rs'

loadWasm().then(result => {
const addOne = result.instance.exports['add_one'];
console.log('return value was', addOne(3));
});
12 changes: 8 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ module.exports = {
rules: [
{
test: /\.rs$/,
type: 'webassembly/experimental',
use: {
use: [{
loader: 'wasm-loader',
},{
loader: 'rust-native-wasm-loader',
options: { gc: true, release: true },
},
options: {
gc: true,
release: true
},
}],
},
],
},
Expand Down
Loading

0 comments on commit 1bbe42b

Please sign in to comment.