Skip to content

Sort modules before binding, sort exports - #2757

Merged
lukastaegert merged 2 commits into
masterfrom
gh-2753-sort-modules-before-bind
Mar 20, 2019
Merged

lukastaegert merged 2 commits into
masterfrom
gh-2753-sort-modules-before-bind

Conversation

@lukastaegert

Copy link
Copy Markdown
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.

@lukastaegert
lukastaegert force-pushed the gh-2753-sort-modules-before-bind branch from 8c96ed1 to 32d7e56 Compare March 18, 2019 12:45
@mislav

mislav commented Mar 19, 2019

Copy link
Copy Markdown
Contributor

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