-
Notifications
You must be signed in to change notification settings - Fork 58
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
Added exports#default #107
base: master
Are you sure you want to change the base?
Conversation
AAdded exports#default, which adds support for things like "rollup-plugin-commonjs" which transpile commonJS modules into ES6 modules before transpilation, and other bundlers which do the same thing. It adds support for es6 modules, and it's only 7 letters, so it's worth it in the long run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about the commit description typo.
doesn't rollup-plugin-commonjs not already convert |
@goto-bus-stop It doesn't bundle correctly. Not sharing source code, but the output is |
I get a correct bundle with the node-resolve and commonjs plugins: https://gist.github.com/goto-bus-stop/2189c8ea9759f52c3e07897f60f66d02 When I try it with this patch, rollup wraps nanomorph in a function (because Bundle snippet(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('assert')) :
typeof define === 'function' && define.amd ? define(['assert'], factory) :
(factory(global.assert));
}(this, (function (assert) { 'use strict';
assert = assert && assert.hasOwnProperty('default') ? assert['default'] : assert;
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var nanomorph_1 = createCommonjsModule(function (module) {
// -- snip --
(module.exports = nanomorph).default = nanomorph;
// -- snip --
});
// vv no .default here vv
nanomorph_1(document.body, browser`
<body>
<div id="test">
<h1>Hello world</h1>
</div>
</body>
`);
}))); What's different about our configs/source code? |
is that error fixed by this patch? it looks totally unrelated… i have no idea where it's getting that |
@goto-bus-stop I don't know why, but for some reason Rollup is hooking the node |
i don't know either. as for this patch, i'm not opposed to it in principle, but i still don't understand how it fixes anything. the errors you're sharing appear entirely unrelated. for it to be accepted, the style changes would have to be reverted so that it passes |
Yeah, sorry about the offtopic stuff. Was doing two different things at once. Anyway, I've seen other libraries do this EDIT: Would also like to add that this fixes |
Added exports#default, which adds support for things like "rollup-plugin-commonjs" which transpile commonJS modules into ES6 modules before transpilation, and other bundlers which do the same thing. It adds support for es6 modules, and it's only 7 letters, so it's worth it in the long run.