Skip to content

Provide more chunk information - #2553

Closed
lukastaegert wants to merge 6 commits into
masterfrom
more-chunk-information
Closed

lukastaegert wants to merge 6 commits into
masterfrom
more-chunk-information

Conversation

@lukastaegert

@lukastaegert lukastaegert commented Nov 12, 2018 •

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:

Description

Breaking changes:

  • Chunks created for entry modules will no longer be marked as isEntry: true if they have a separate entry module facade as the facade replaces the chunk
  • Dynamic entry points will no longer be marked as isEntry: true and no longer use the entryFileNames but the chunkFileNames naming scheme unless they are also listed as actual entry points in the inputs

This PR aims to provide more information about the generated chunks in the return values of generate and write as well as the generateBundle hook. This is still work-in-progress and will be updated. Currently implemented changes:

  • If a separate facade is created for an entry chunk, only the facade but not the original chunk is marked as isEntry: true. Thus there is a one-to-one correspondence of inputs and entry chunks
  • To be able to identify facades and inputs, all entry chunks have a new entryModuleId property which contains the id of the corresponding entry module.
  • When there is a potential naming conflict between entry chunks (i.e. facade chunks) and other chunks (including facaded chunks), giving the facade the proper name now takes precedence
  • Dynamic chunks will no longer be treated as entry points unless they are actually listed as such in the input. That means that by default, isEntry is false for them and their names are determined via the chunkFileNames property instead of the entryFileNames property
  • Dynamic chunks receive an isDynamicEntry: true property
  • The name property used when generating chunk names is exposed via name.

Note: There is an issue when dynamically importing a manual chunk. This issue was present before but manifests now differently. I plan on working on a PR that fixes this in a more substantial way soon. Until then, the corresponding test is skipped.

@lukastaegert
lukastaegert force-pushed the more-chunk-information branch 3 times, most recently from 95f4c84 to 0ba4d26 Compare November 16, 2018 05:35
@lukastaegert lukastaegert changed the title [WIP] Provide more chunk information Provide more chunk information Nov 16, 2018
* Give precedence to entry facades when deconflicting ids
* Add entryModuleId to entry facades
…ry points

* Use internal names for dynamic entry points
* Do not generate dynamic entry points that are not used
@lukastaegert
lukastaegert force-pushed the more-chunk-information branch from 1283ee0 to 9887f3c Compare November 17, 2018 08:01
@lukastaegert
lukastaegert force-pushed the more-chunk-information branch from 9887f3c to 5a73390 Compare November 17, 2018 13:10
@tivac

tivac commented Nov 26, 2018

Copy link
Copy Markdown
Contributor

While trying to solve my "CSS shadow dependency graph" issues in @modular-css/rollup#rework-rollup I ran into some issues that this PR would fix, but it doesn't address another small issues. Might not be the right place for this, but it's the closest I've found.

Chunks that use import() to load another chunk dynamically don't have any information about their dynamic dependencies. Normal import statement chunking causes the chunk to have entries in their imports array, but not when using import(). Is that expected? Should they be called out in a dynamicImports array or something?

I'm trying to ensure the CSS gets chunked up like the JS but w/o that crucible piece of information I can really only get like 80% of the way there.

tivac added a commit to tivac/modular-css that referenced this pull request Nov 27, 2018
Dynamic imports still failing: rollup/rollup#2553 (comment)
@lukastaegert lukastaegert mentioned this pull request Dec 1, 2018
5 of 9 tasks
@lukastaegert

Copy link
Copy Markdown
Member Author

Closed in favour of #2757.
@tivac I will see if I can add some information about dynamic imports to that PR

@tivac

tivac commented Dec 1, 2018

Copy link
Copy Markdown
Contributor

Sounds great, thanks @lukastaegert!

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.

2 participants