Fix #2084: export all as default #2091

merged 1 commit into from Nov 26, 2016


None yet

2 participants

cognitom commented Nov 24, 2016 edited

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.


See #2084


I think it will close this issue, too.

@GianlucaGuarini GianlucaGuarini merged commit 2fc1934 into dev Nov 26, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed

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


@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.

@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