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

Imports are incorrectly reordered #2490

Closed
bdwain opened this issue Oct 3, 2018 · 5 comments · Fixed by #2508
Closed

Imports are incorrectly reordered #2490

bdwain opened this issue Oct 3, 2018 · 5 comments · Fixed by #2508

Comments

@bdwain
Copy link

bdwain commented Oct 3, 2018

  • Rollup Version: 0.66.2 (but this seems to have been introduced in 0.55)
  • Operating System (or Browser): OS X High Sierra
  • Node Version: 9.11.1

How Do We Reproduce?

repl reproduction

Expected Behavior

The original import order should be maintained

Actual Behavior

The imports that pull in content from other files get pushed to the top, above imports that are not resolved (because they are external packages)

@jamiewinder
Copy link

Fixed link

@bdwain
Copy link
Author

bdwain commented Oct 3, 2018

oops thanks @jamiewinder . fixed in the original

@bdwain
Copy link
Author

bdwain commented Oct 3, 2018

I was able to work around this temporarily by moving the imports that need to be first to a separate file

repl

@lukastaegert
Copy link
Member

Ok, this issue was a really enlightening one. Previously, the only guarantees our bundling had were:

  • Modules inside a bundle/chunk have the correct execution order
  • An internal or external import is executed before the importing module

There was, however, no guarantee that external imports were executed in a particular order between themselves. I created a PR that solves your problem and many similar problems at the same time while improving execution order, please check it out: #2508

@bdwain
Copy link
Author

bdwain commented Oct 14, 2018

Awesome! Thank you!

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

Successfully merging a pull request may close this issue.

3 participants