-
Notifications
You must be signed in to change notification settings - Fork 205
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 #66
ESM #66
Conversation
Just my random Monday morning thought... (I might not be fully awake yet) Something along the lines of // ES6 by default, but metascript can convert to a CJS version
//? if (typeof USE_CJS !== 'undefined') {
//?= 'module.exports = Long;'
//? } else {
export default Long;
//? } "build:node": "metascript src/long.js -USE_CJS=true > dist/long.cjs.js" Or perhaps to appease Travis, keep the original CJS and metascript a ES6 module version? // CJS by default, but metascript can convert to a ES6 module version
//? if (typeof ES6_MOD !== 'undefined') {
//?= 'export default Long;'
//? } else {
module.exports = Long;
//? } "build:esmod": "metascript src/long.js -ES6_MOD=true > es6mod/long.js",
. . .
"module": "es6mod/long.js",
"main": "src/long.js", |
Babel is not support in Node 0.12 anymore. @dcodeIO would you mind removing this legacy node version? |
Notice that Even if you change the CommonJS transpilation to keep using Not saying that we shouldn't support ESM. It's just really hard to do it without breaking backwards compatibility with other module loaders and bundlers. 😓 |
The sources is now a ECMAScript module and is transpiled down to cjs before being published. User can consume the ESM build directly (which I do).