Skip to content
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

ESM changes #144

Closed
niksy opened this issue Mar 30, 2019 · 1 comment
Closed

ESM changes #144

niksy opened this issue Mar 30, 2019 · 1 comment
Assignees

Comments

@niksy
Copy link
Owner

niksy commented Mar 30, 2019


Use .mjs extension for ES Modules


Additional information:

@niksy niksy self-assigned this Mar 30, 2019
@niksy
Copy link
Owner Author

niksy commented Oct 26, 2020

https://dev.to/mikeal_2/native-esm-in-node-js-w-require-fallbacks-and-support-for-all-front-end-compilers-2ded
https://redfin.engineering/node-modules-at-war-why-commonjs-and-es-modules-cant-get-along-9617135eeca1
sindresorhus/project-ideas#116
webpack/webpack#4674 (comment)
https://github.com/multiformats/js-multiformats/blob/master/package.json
https://nodejs.org/api/packages.html#packages_package_entry_points
https://nodejs.org/api/packages.html#packages_dual_commonjs_es_module_packages
https://medium.com/@WebReflection/a-nodejs-dual-module-deep-dive-8f94ff56210e
https://twitter.com/webreflection/status/1235537753690890240?s=12
https://2ality.com/2019/10/hybrid-npm-packages.html

cjs and esm folder, type field

--experimental-modules

{
	"type": "module",
	"main": "./index.cjs.js",
	"module": "./index.esm.js",
	"exports": {
		".": {
			"import": "./index.esm.js",
			"require": "./index.cjs.js",
			"browser": "./index.browser.esm.js",
			"default": "./index.cjs.js",
		},
		"./throttle.js": {
			"import": "./throttle.esm.js",
			"require": "./throttle.cjs.js",
			"browser": "./throttle.browser.esm.js",
			"default": "./throttle.cjs.js",
		},
		"./debounce.js": {
			"import": "./debounce.esm.js",
			"require": "./debounce.cjs.js",
			"browser": "./debounce.browser.esm.js",
			"default": "./debounce.cjs.js",
		}
	},
	"browser": {
		"./index.esm.js": "./index.browser.esm.js",
		"./throttle.esm.js": "./throttle.browser.esm.js",
		"./debounce.esm.js": "./debounce.browser.esm.js"
	}
}

@niksy niksy closed this as completed in dcbcd69 Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant