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

UMD re-export incorrect after re-exporting an external module #1322

Closed
christopherthielen opened this issue Mar 4, 2017 · 1 comment
Closed

Comments

@christopherthielen
Copy link
Contributor

christopherthielen commented Mar 4, 2017

Re-export an external module. Then re-export an internal module. Generate a UMD bundle. The internal module symbols are exported as if they came from the external module.

Minimal reproduction: https://github.com/christopherthielen/rollup-bug

git clone https://github.com/christopherthielen/rollup-bug
cd rollup-bug
yarn install
yarn build
cat _bundles/rollup-bug.js

localmodule.js

export const FOO = "foo";

index.js

export * from "ui-router-core";
export * from "./localmodule";

UMD bundle

Object.keys(uiRouterCore).forEach(function (key) { exports[key] = uiRouterCore[key]; });
exports.FOO = uiRouterCore.FOO; // FOO is not on uiRouterCore, it's an internal module.
Object.defineProperty(exports, '__esModule', { value: true });

Interestingly, swapping the order of re-exports seems to work (re-export external modules last)

index.js

export * from "./localmodule";
export * from "ui-router-core";
@christopherthielen christopherthielen changed the title UMD export incorrect: re-export an external module, then re-export an internal module UMD re-export incorrect after re-exporting an external module Mar 4, 2017
christopherthielen added a commit to ui-router/angular that referenced this issue Mar 5, 2017
christopherthielen added a commit to angular-ui/ui-router that referenced this issue May 8, 2017
@guybedford
Copy link
Contributor

This is an interesting bug and unfortunately there's nothing that can really be done here as we don't know if UI-Router-Core does export a FOO or not, so we have to assume it does.

Changing the export order sounds like the right fix here to me.

Marking as a wontfix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants