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

Provide a warning when export * externals ambiguously capture #1800

Open
mfedderly opened this issue Dec 18, 2017 · 6 comments
Open

Provide a warning when export * externals ambiguously capture #1800

mfedderly opened this issue Dec 18, 2017 · 6 comments

Comments

@mfedderly
Copy link

Having an export * from "package" statement seems to cause the generated javascript to export things from the wrong source. I should mention that this code is getting transpiled from typescript, so I'd get an error if any of the exports had name collisions.

Error Repro
Similar but working

It seems to me that exporting an entire package is a bad idea anyhow, so I I'm going to go ahead and remove it. I figured I would file a bug anyhow in case there's a better way of handling this situation. I'm unsure of the module semantics around exports, does ordering matter for multiple export * statements?

@guybedford
Copy link
Contributor

Unfortunately this is a consequence of the way Rollup has to assume external star exports might catch any given export name. So ordering does matter here yes.

We could possibly provide options to configure this sort of thing but I get the feeling that tweaking the ordering in the code base is an easier more sensible fix, even if this is a somewhat Rollup-specific scenario.

@guybedford
Copy link
Contributor

Closing, but happy to continue discussion on this.

@mfedderly
Copy link
Author

I have fixed the issue by changing all of my exports to be explicitly named. Any chance to at least get a warning when this scenario happens? It would've saved me having to dig through the generated code to figure out what caused the issue.

@guybedford
Copy link
Contributor

Reopening to note this should be a warning.

@guybedford guybedford reopened this Feb 17, 2018
@guybedford guybedford changed the title Package export * behavior is incorrect Provide a warning when export * externals ambiguously capture Feb 17, 2018
@shellscape
Copy link
Contributor

@lukastaegert is this still an issue in the latest version?

@lukastaegert
Copy link
Member

Yes, it is still an issue. Just to recapitulate for future reference, the issue is that in any situation where an external star re-export overlaps with another star import (external or not), we want to display a warning that the behaviour might not be 100% accurate as Rollup will

  • prioritize internal reexports over external ones
  • not throw errors when there is a name conflict (which the spec says should happen as far as I know)

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

No branches or pull requests

4 participants