When running wasm-pack build --target bundler --scope scopename modulename, there is are both *.js and *_bg.js files generated. the package.json file looks like this
{
"name": "@scopename/modulename",
"collaborators": [
"arlo <[email protected]>"
],
"version": "0.4.3",
"files": [
"modulename_bg.wasm",
"modulename.js",
"modulename.d.ts"
],
"module": "modulename.js",
"types": "modulename.d.ts",
"sideEffects": false
}
I think the modulename.js line in files should be modulename_bg.js, since modulename.js file will be included anyway because of the "module": "modulename.js" line. I'm not sure about that detail, but when i do wasm-pack pack, the generated tar ball is missing the modulename_bg.js file, so my module doesn't work
wasm-pack build --target bundler --scope scopename modulename
Include the relevant details of your environment.
wasm-pack version: 0.9.1
rustc version: rustc 1.43.0 (4fb7144ed 2020-04-20)
After testing this out locally, it looks like both modulename.js and modulename_bg.js should be in the files list
I've just hit this, and it makes it really easy to publish packages to NPM that don't work (I've had to re-publish packages twice already because of this, meaning version bumps). The fix is apparently already merged, any chance that this can be released soon?
@Alxandr I'm just waiting for @ashleygwilliams to add me as an owner on wasm-pack so I can do the publish.
Hit this as well, already created 2 broken releases on npm :confused:
I hate to ping people, but since it's been over a month since the fix already: It would be awesome if this could be released on crates.io, @ashleygwilliams :slightly_smiling_face:
For anyone coming here from google who wants a temporary solution, my current workaround is something like
$ git clone [email protected]:rustwasm/wasm-pack.git
$ cd wasm-pack
$ cargo run -- build --target bundler ../my_wasm_project
Seems to work, but I wouldn't recommend relying on it
I think @ashleygwilliams is catching up and we'll probably have a new release not far away.
Meanwhile, to fix a broken package, I just had to:
Another option:
Use cargo install --git https://github.com/rustwasm/wasm-pack.git instead
Most helpful comment
Another option:
Use
cargo install --git https://github.com/rustwasm/wasm-pack.gitinstead