Skip to content

Add type = "module" in package.json to support nodejs in bundler mode #1039

Closed
@josephg

Description

@josephg

💡 Feature description

When you build using the default "bundler" mode, it can almost run directly from nodejs, using nodejs's built in ESM support.

Unfortunately, the created package.json file is missing "type": "module". Adding this to the created package.json not only fixes some bundler issues, but also makes nodejs understand the created package too:

foo.js:

import {greet} from 'my_module'
greet()
$ node --experimental-wasm-modules foo.js
(node:414396) ExperimentalWarning: Importing Web Assembly modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Hello world!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions