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

default export should behave differently when it's the only export #12

Open
miloxeon opened this issue Sep 3, 2020 · 1 comment
Open

Comments

@miloxeon
Copy link

miloxeon commented Sep 3, 2020

When I don't use esmify and I write

module.exports = () => { ... }

and I build it like

browserify source.js -o dist.js -s "foo"

I can just write foo() and my function will be executed. However, when I use esmify and I write

export default () => {}

and build it the same way, foo actually represents an object that contains default property, so if I want to call it, I should write

foo.default()

I think that if there is a default export and there are no more exports, that exported value should be set to window.foo instead of an object.

@miloxeon
Copy link
Author

miloxeon commented Sep 4, 2020

I discovered a Rollup solution that does exactly what Browserify and Esmify can't and it does it much quicker.

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

No branches or pull requests

1 participant