Skip to content

Declare a "main file" or index.js in the generated module #94

Closed
@mstange

Description

@mstange

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    PR attachedthere's a PR open for this issueenhancementNew feature or requestto-dostuff that needs to happen, so plz do it k thx

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions