Skip to content

Conversation

@jamie-pate
Copy link

…sers

Fixes #206
This ensures that consumers using --experimental-modules with node 12+
will import the esm version of this package.

This package's export MUST have .mjs file extension... (because
otherwise the entire package must be specified as type: module)
This package's export MUST use exports field in the package.json
see https://nodejs.org/api/packages.html#conditional-exports

Not sure how to test this with a bunch of different project styles..
webpack and other loaders should be fine with importing from the
module field with a .mjs file extension?

@jamie-pate
Copy link
Author

Looks like we can create a package.json in the es5m dir that only has {"type": "module"} to satisfy NodeJS

…sers

Fixes insidewhy#206
This ensures that consumers using --experimental-modules with node 12+
will import the esm version of this package.

This package's export must a package.json with "type": "json" (or module
files must have .mjs extension)...
This package's export must also use exports field in the package.json
because node doesn't support the "module" field as an alternative to
"main".
	see https://nodejs.org/api/packages.html#conditional-exports
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

Successfully merging this pull request may close these issues.

Add exports field to support newer versions of nodejs

1 participant