Skip to content

Commit

Permalink
examples: checkpoint
Browse files Browse the repository at this point in the history
mostly for record keeping; me vs javascript tooling round 5000

tried to drop the preprocessing in parcel-plugin-wasm.rs by going with --target web
turns out that doesn't make any sense
didn't realize this until _after_ writing it though; i've now seen way more parcel innards than i ever thought i'd need too
(somehow the actual type of the generated field for assets is just not documented — reading the other assets to figure it out actually hurts more than it helps)
((also, parcel uses flow but not for these parts))

import.meta also made things pretty irritating (babel/babel#11364)

went on an hour long detour through all the wasm-pack/wasm-bindgen options and how to best expose/use them through the plugin

tried to use the bundler option (when not running on Node) also explodes in spectacular fashion; somehow parcel's wasm load just doesn't pass in imports

I'm actually starting to think the find and replace scheme that's used right now is actually optimal..
So, really, it's parcel's fault.

Webpack does the right thing here: parcel-bundler/parcel#647

I was going to say that this plugin (parcel-plugin-wasm-pack) manages to do better but really they do the exact same thing in a slightly less clumsy way: https://github.com/mysterycommand/parcel-plugin-wasm-pack/blob/f204a708d964127aaa1e5d278f41a44f5d76393b/src/WasmPackAsset.js#L174-L179
They do have tests though which is commendable
  • Loading branch information
rrbutani committed May 19, 2020
1 parent 3dffeae commit 2636b89
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,27 @@
"license": "MIT",
"scripts": {
"watch": "parcel index.html",
"release": "WASM_PACK_PROFILE=release parcel build index.html"
"release": "WASM_PACK_PROFILE=release NODE_ENV=production parcel build index.html",
"//": "drop WASM_PACK_PROFILE=release when (if) things get merged"
},
"dependencies": {
"xterm": "^4.5.0",
"xterm-addon-fit": "^0.3.0",
"xterm-addon-web-links": "^0.3.0"
},
"devDependencies": {
"@babel/core": "^7.9.6",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.8.3",
"parcel-bundler": "^1.12.4",
"parcel-plugin-wasm.rs": "^1.2.15",
"parcel-plugin-wasm.rs": "rrbutani/parcel-plugin-wasm.rs",
"//": "^ should be switched back if/when the PR gets merged..",
"//parcel-plugin-wasm.rs": "file:../../../../../JS/parcel-plugin-wasm.rs",
"typescript": "^3.8.3"
},
"babel": {
"plugins": [
"@babel/plugin-syntax-import-meta"
]
}
}

0 comments on commit 2636b89

Please sign in to comment.