Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm-pack build --target bundler not including *_bg.js file in package.json #837

Closed
arlopurcell opened this issue May 1, 2020 · 9 comments · Fixed by #839
Closed

wasm-pack build --target bundler not including *_bg.js file in package.json #837

arlopurcell opened this issue May 1, 2020 · 9 comments · Fixed by #839

Comments

@arlopurcell
Copy link

🐛 Bug description

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 <arlo@purcell.live>" ], "version": "0.4.3", "files": [ "modulename_bg.wasm", "modulename.js", "modulename.d.ts" ], "module": "modulename.js", "types": "modulename.d.ts", "sideEffects": false }

🤔 Expected Behavior

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

👟 Steps to reproduce

wasm-pack build --target bundler --scope scopename modulename

🌍 Your environment

Include the relevant details of your environment.
wasm-pack version: 0.9.1
rustc version: rustc 1.43.0 (4fb7144ed 2020-04-20)

@arlopurcell
Copy link
Author

After testing this out locally, it looks like both modulename.js and modulename_bg.js should be in the files list

@Alxandr
Copy link

Alxandr commented May 22, 2020

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?

@Pauan
Copy link
Contributor

Pauan commented Jun 4, 2020

@Alxandr I'm just waiting for @ashleygwilliams to add me as an owner on wasm-pack so I can do the publish.

@dbrgn
Copy link

dbrgn commented Jun 9, 2020

Hit this as well, already created 2 broken releases on npm 😕

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 🙂

@prestwich
Copy link

prestwich commented Jun 25, 2020

For anyone coming here from google who wants a temporary solution, my current workaround is something like

$ git clone git@github.com: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

@pachi
Copy link

pachi commented Jul 1, 2020

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:

  • edit pkg/package.json to include the *_bg.js file
  • increase the version number
  • do a wasm-pack publish after it.

@kigawas
Copy link

kigawas commented Dec 7, 2020

Another option:

Use cargo install --git https://github.com/rustwasm/wasm-pack.git instead

@lucperkins
Copy link

Wait, why was this issue closed? This problem is still present in v0.9.1 (the current version) and bit me as well. I would strongly encourage the maintainers to address this.

@kigawas
Copy link

kigawas commented Mar 15, 2021

Wait, why was this issue closed? This problem is still present in v0.9.1 (the current version) and bit me as well. I would strongly encourage the maintainers to address this.

It looks like repos under the rustwasm org are not actively maintained ;-p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants