Description
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 the main
property in the module's package.json, one would be able to use just import("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:
@mgattozzi/wasm-add
lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually