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

Bundle the wasm file #5

Open
DerThorsten opened this issue Oct 6, 2021 · 4 comments
Open

Bundle the wasm file #5

DerThorsten opened this issue Oct 6, 2021 · 4 comments

Comments

@DerThorsten
Copy link
Collaborator

now that we move the xeus lua related files to the asset dir via https://github.com/DerThorsten/jupyterlite_xeus_lua/blob/3a22e56672ef5aca0655fc64aaa39fac74e5b6a2/webpack.config.js#L4

we are facing the problem that xeus_lua.js it not found

ModuleNotFoundError: Module not found: Error: Can't resolve './xeus_lua' in '/home/derthorsten/src/jupyterlite_xeus_lua/lib'
    at /home/derthorsten/src/jupyterlite_xeus_lua/node_modules/webpack/lib/Compilation.js:1930:28
    at /home/derthorsten/src/jupyterlite_xeus_lua/node_modules/webpack/lib/NormalModuleFactory.js:793:13
    at eval (eval at create (/home/derthorsten/src/jupyterlite_xeus_lua/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
    at /home/derthorsten/src/jupyterlite_xeus_lua/node_modules/webpack/lib/NormalModuleFactory.js:275:22
    at eval (eval at create (/home/derthorsten/src/jupyterlite_xeus_lua/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at /home/derthorsten/src/jupyterlite_xeus_lua/node_modules/webpack/lib/NormalModuleFactory.js:431:22
    at /home/derthorsten/src/jupyterlite_xeus_lua/node_modules/webpack/lib/NormalModuleFactory.js:124:11
    at /home/derthorsten/src/jupyterlite_xeus_lua/node_modules/webpack/lib/NormalModuleFactory.js:665:25
    at /home/derthorsten/src/jupyterlite_xeus_lua/node_modules/webpack/lib/NormalModuleFactory.js:850:8
    at /home/derthorsten/src/jupyterlite_xeus_lua/node_modules/webpack/lib/NormalModuleFactory.js:970:5
resolve './xeus_lua' in '/home/derthorsten/src/jupyterlite_xeus_lua/lib'
...
...
...

@jtpio you mentioned:

Locally excluding the emscripten generated files seems to help build the extension.

However the files are not properly emitted to labextension/static yet.

@jtpio any hint on how to continue on that?

Do we need to change the import statement?
https://github.com/DerThorsten/jupyterlite_xeus_lua/blob/3a22e56672ef5aca0655fc64aaa39fac74e5b6a2/src/worker.ts#L3

this is all a bit beyond my typescript / webpack competence ...

@jtpio
Copy link
Member

jtpio commented Oct 6, 2021

we are facing the problem that xeus_lua.js it not found

This part seems to be because xeus_lua.js is not in lib and webpack doesn't find it. So we can reintroduce the copy-files script make sure they are.

Do we need to change the import statement?

Also the wasm file seems to be defined in the emscripten generated file like this:

image

Ideally webpack should be able to find it, so it can generate a URL to the asset automatically (with the public path).

I'm continuing in #6.

@DerThorsten
Copy link
Collaborator Author

DerThorsten commented Oct 6, 2021

bevore I jused the CopyPlugin for the wasm file. Since webpack only looks for imports it is not touching the xeus_lua.wasm string. (since there is nothing like import 'xeus_lua.wasm' )
https://github.com/DerThorsten/jupyterlite/blob/65762755e33aa661a5f46f037eefb1c347aac06a/app/webpack.config.js#L268

@jtpio
Copy link
Member

jtpio commented Oct 6, 2021

Yes maybe we'll have to use the same approach for now.

Ideally we can find a way to tell webpack to find this wasm file, so it places it along the others under labextension/static, and is able to locate it via a URL such as /lab/extensions/@jupyterlite/xeus-lua/static/12345.wasm (since the extension will be loaded as a federated module).

@jtpio jtpio changed the title troubleshooting Bundle the wasm file Oct 7, 2021
@jtpio
Copy link
Member

jtpio commented Oct 7, 2021

I renamed the issue to "Bundle the wasm file" so we can come back to how to best handle the copy of the wasm file later.

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

No branches or pull requests

2 participants