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

Fix #2084: export all as default #2091

Merged
merged 1 commit into from Nov 26, 2016
Merged

Fix #2084: export all as default #2091

merged 1 commit into from Nov 26, 2016

Conversation

@cognitom
Copy link
Member

@cognitom cognitom commented Nov 24, 2016

1. Have you added test(s) for your patch? If not, why not?

I could add a test later. Or we could merge this soon as a hot fix for ES6 users, I think. This change has no effect for existing codes.

Content

See #2084

@cognitom
Copy link
Member Author

@cognitom cognitom commented Nov 25, 2016

I think it will close this issue, too.
riot/rollup-plugin-riot#1

@GianlucaGuarini GianlucaGuarini merged commit 2fc1934 into dev Nov 26, 2016
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@GianlucaGuarini
Copy link
Member

@GianlucaGuarini GianlucaGuarini commented Nov 26, 2016

thanks @cognitom probably in future we will need to integrate the export default directly in riot.js avoiding an extra file only for the es6 exports

@cognitom
Copy link
Member Author

@cognitom cognitom commented Nov 26, 2016

@GianlucaGuarini thanks!

Yeah, I hope so, too. I made another file index.js because of a issue below.
Bundlers like Rollup doesn't support the hybrid approach. For example, in this case, const c would be exported in ES6 syntax:

export const a = 'apple'
export const b = 'banana'
export const c = 'coffee'
export default {a, b}

But not in the compiled CommonJS code:

module.exports = {
  a: 'apple',
  b: 'banana'
}

Because default has priority than named exports.

So we need to carefully sync named exports and its default always. The point of this PR is that there's no need to sync them manually, I think.

@cognitom cognitom mentioned this pull request Dec 7, 2016
1 of 7 tasks complete
GianlucaGuarini added a commit that referenced this pull request Jan 10, 2017
@GianlucaGuarini GianlucaGuarini deleted the fix/export-default branch Jan 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.