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

WebAssembly module is included in initial chunk #146

Open
sc-laurence opened this issue Apr 30, 2020 · 2 comments
Open

WebAssembly module is included in initial chunk #146

sc-laurence opened this issue Apr 30, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@sc-laurence
Copy link

Describe the Bug

I have followed the example https://rustwasm.github.io/docs/book/game-of-life/implementing.htm and modified it to use the petgraph crate and try to build a module to use wasm to store tree structure for JS.

The module compiles and seems to work following the tutorial, however if I tried to include the package locally in another project e.g. https://github.com/bbofrk/trying-wasm, or even tried publishing the package on npm (https://www.npmjs.com/package/wasm-tree-structure) then installing in into another project. I am getting the same error

WebAssembly module is included in initial chunk. friendly-errors 09:45:56
This is not allowed, because WebAssembly download and compilation must happen asynchronous.

Steps to Reproduce

  1. clone https://github.com/bbofrk/trying-wasm
  2. run npm install
  3. run npm run dev
  4. See error

Expected Behavior

Should not see compile error

Actual Behavior

WebAssembly module is included in initial chunk. friendly-errors 09:45:56
This is not allowed, because WebAssembly download and compilation must happen asynchronous.

Additional Context

This might have something to do with my webpack.config.js or in this case nust.config.js but I could not tell what should be included. So apologis in advance if its my personal error

@tlaukkan
Copy link

tlaukkan commented May 2, 2020

I am facing this same problem in vue-cli-service application. The rust-webpack-template works as it is using custom webpack plugin. Does this work with normal webpack configuration where you pull the package from npm? If someone has this working could you kindly post example webpack config and webpack version.

https://github.com/rustwasm/rust-webpack-template:

new WasmPackPlugin({
  crateDirectory: __dirname,
}),

@tlaukkan
Copy link

tlaukkan commented May 3, 2020

Managed to get this working so that single package works for both node and webpack using manually created package with separate glue js and wasm files. Details here:

rustwasm/wasm-pack#705 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants