Skip to content

Assign chunk IDs before creating outputBundle chunks - #2483

Merged
lukastaegert merged 5 commits into
masterfrom
gh-2461
Oct 2, 2018
Merged

Assign chunk IDs before creating outputBundle chunks#2483
lukastaegert merged 5 commits into
masterfrom
gh-2461

Conversation

@Rich-Harris

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

@guybedford guybedford left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor Author

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

@guybedford guybedford left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great.

@lukastaegert lukastaegert left a comment

Copy link
Copy Markdown
Member

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.

3 participants