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

Assign chunk IDs before creating outputBundle chunks #2483

Merged
merged 5 commits into from Oct 2, 2018
Merged

Conversation

Rich-Harris
Copy link
Contributor

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:

#2461

Description

The chunk object that is passed to the renderChunk hook (and which forms the properties of the output bundle object) contains, inter alia, an imports array specifying the IDs of the external modules and chunks the chunk depends on.

Currently, the loop that assigns the IDs to the chunk is the same as the loop that gets the imported IDs; consequently the imported IDs are frequently undefined.

This PR separates ID assignation into a separate loop.

Copy link
Contributor

@guybedford guybedford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, this seems like how it should work!

@guybedford
Copy link
Contributor

The CI failure seems to do with the assignment of numbers to named chunks with the same chunk name - I checked it out and it seems fine to update the tests to what is being output, and right as well that the first chunk (1) is the one being named 1.

@Rich-Harris
Copy link
Contributor Author

Huh, it looks like it's only generating one chunk instead of three in that test? Investigating...

Copy link
Contributor

@guybedford guybedford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great.

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@lukastaegert lukastaegert merged commit ad21dd8 into master Oct 2, 2018
@lukastaegert lukastaegert deleted the gh-2461 branch October 2, 2018 16:51
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.

None yet

3 participants