jsnext:main should not point to completely untranspiled code
wdhorton opened this issue · comments
From the Rollup docs:
jsnext:main will point to a module that has ES2015 module syntax but otherwise only syntax features that node supports.
Libraries that expose an ES6 module build should transpile the code in a way that makes it ES5-compatible, but leaves "import" and "export" statements intact. The reason is that we can't transpile all node_modules for a project, nor would we know what babel config to use on each of them. See this conversation for more discussion. Pointing "jsnext:main" to a file with the "class" keyword is breaking our build.
+1
+1
Fixed by #23
Unfortunately, this appears to be broken in a different way now. The jsnext:main
field is indeed pointing to code that node can run, but the exports are no longer compatible with the es2015 format:
exports.default = ExtendableError;
module.exports = exports['default'];
That is commonJS module syntax. The file that jsnext:main
points to should be doing:
export default ExtendableError;
Should we reopen the issue and track that here, or should I open a new issue for it?
See #25