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

doesn't work in browser #2

Closed
acarl005 opened this issue Aug 21, 2018 · 5 comments
Closed

doesn't work in browser #2

acarl005 opened this issue Aug 21, 2018 · 5 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@acarl005
Copy link

Hello. I love the idea of leveraging expat in JS, but I want to use it in the browser. I tried bundling this module with Webpack, but I get this error

Uncaught (in promise) abort("abort(\"on the web, we need the wasm binary to be preloaded and set on Module['wasmBinary']. emcc.py will do that for you when generating HTML (but not JS)\"). Build with -s ASSERTIONS=1 for more info."). Build with -s ASSERTIONS=1 for more info.
@hildjj hildjj added bug Something isn't working help wanted Extra attention is needed labels Aug 23, 2018
@kaymccormick
Copy link

Ddi you try following the instructions? What is your overall project and webpack configuration?

@kaymccormick
Copy link

this is my error:

ERROR in ./node_modules/expat-wasm/lib/expat.wasm
Module not found: Error: Can't resolve 'env' in '/local/home/jade/work/github/react/myapp1/node_modules/expat-wasm/lib'
@ ./node_modules/expat-wasm/lib/expat.wasm
@ ./node_modules/expat-wasm/lib/evented.js
@ ./node_modules/expat-wasm/lib/index.js
@ ./src/test-asm.js
@ ./src/App.js
@ ./src/index.js
@ multi (webpack)-dev-server/client?http://0.0.0.0:8080 ./src/index.js

@hildjj
Copy link
Owner

hildjj commented Feb 6, 2019

I'm looking into this. webpack/webpack#7352 seems relevant

@kaymccormick
Copy link

Now I get:

evented.js:6 Uncaught (in promise) TypeError: Cannot create property 'onRuntimeInitialized' on string '1c1d0270774c5f18efd667e84754f919.wasm'
at push../node_modules/expat-wasm/lib/evented.js.resolve (evented.js:6)
at new Promise ()
at Object../node_modules/expat-wasm/lib/evented.js (evented.js:5)
at webpack_require (bootstrap:63)
at Object../node_modules/expat-wasm/lib/index.js (index.js:3)
at webpack_require (bootstrap:63)
at webpack_require.t (bootstrap:158)

I pretty much have no idea how any of this stuff works! But I'll poke around some more and try to do some troubleshooting and make a repro case.

@hildjj hildjj closed this as completed in a4201c7 Apr 4, 2019
@hildjj
Copy link
Owner

hildjj commented Apr 4, 2019

I hacked this to work, and I'm not terribly proud of the solution, which included base64-encoding the .wasm file and embedding it into a node module.

It may be that WASM ESM integration may make this better one day. The goal is a consistent way of using WASM-based npm packages built with emscripten in both node and on the web.

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

No branches or pull requests

3 participants