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

Sort modules before binding, sort exports #2757

Merged
merged 2 commits into from Mar 20, 2019

Conversation

lukastaegert
Copy link
Member

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:
Resolves #2753

Description

This resolves #2753 and even improves tree-shaking results in some cases by sorting all modules by their execution order before binding variables to their definitions. When binding variables, some tree-shaking preparations are performed as well which do not work as well when the modules are execution in an order different from their execution order, resulting in more included code.

To also make the output more stable, readable, and less dependent on implementation details, exports are also sorted by name now.

@mislav
Copy link
Contributor

mislav commented Mar 19, 2019

Thank you for the fix! Confirmed that running patched rollup -c in a loop consistently produces the same result over and over.

@lukastaegert lukastaegert force-pushed the gh-2753-sort-modules-before-bind branch from 32d7e56 to 4a279c5 Compare March 20, 2019 06:49
@lukastaegert lukastaegert merged commit 4080c2c into master Mar 20, 2019
@lukastaegert lukastaegert deleted the gh-2753-sort-modules-before-bind branch March 20, 2019 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Indeterminism when generate builds
2 participants