-
Notifications
You must be signed in to change notification settings - Fork 418
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
Declare a "main file" or index.js in the generated module #94
Comments
hey! so it would be pretty trivial to declare the file as |
Sounds good! My intuition would be to use |
But I don't know enough about npm packages to say whether not using |
yeah if we call it index.js we don't have to throw it in main, but i might do it anyways :) |
this should land shortly and ideally 0.2.0 can be released very soon! thanks for bringing this up! |
Thanks for fixing it so quickly! Also, wasm-pack is an awesome tool! |
Ohhh so that's why the es6 module require wasn't working. Thanks! :D |
In the wasm-add example, the main JS file in the generated module is
wasm-add/wasm_add.js
. This means that you have to specify the JS filename when importing that module e.g. through webpack.If the generated JS file were called
index.js
instead, or if its name was declared as the main file using themain
property in the module's package.json, one would be able to use justimport("wasm-add")
to import the module, which would be a bit nicer.This would also allow the "test in your browser" button on the npm package site to work more smoothly. For example, if you click that button on https://www.npmjs.com/package/@mgattozzi/wasm-add, you get to https://npm.runkit.com/@mgattozzi/wasm-add, which says:
The text was updated successfully, but these errors were encountered: