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

Per output chunking #3645

Merged
merged 20 commits into from Jun 22, 2020
Merged

Per output chunking #3645

merged 20 commits into from Jun 22, 2020

Conversation

lukastaegert
Copy link
Member

@lukastaegert lukastaegert commented Jun 20, 2020

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 #3467
Resolves #2701

Description

This is a HUGE refactoring that I have been wanting to do for ages. Basically what it does is that it moves the entire chunking logic from the build phase to the output generation phase. This fixes a long-standing bug (#3467) but also allows us to turn

  • inlineDynamicImports
  • preserveModules
  • manualChunks

into output options!
This allows the same build to generate e.g. an output with inlined imports together with a regular output etc. with little additional performance overhead. Or to do output specific optimizations via output.manualChunks.

In the future, this may also enable Rollup to generate different chunks based on the format e.g. to deduplicate interop helpers (not implemented yet).

Performance overhead when generating several outputs with the same chunks should be reasonably small I hope.

This is ready for release, feedback welcome!

@rollup-bot
Copy link
Collaborator

rollup-bot commented Jun 20, 2020

Thank you for your contribution! ❤️

You can try out this pull request locally by installing Rollup via

npm install rollup/rollup#per-output-chunking

or load it into the REPL:
https://rollupjs.org/repl/?circleci=12091

@codecov
Copy link

codecov bot commented Jun 20, 2020

Codecov Report

Merging #3645 into master will increase coverage by 0.15%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3645      +/-   ##
==========================================
+ Coverage   96.54%   96.70%   +0.15%     
==========================================
  Files         183      183              
  Lines        6245     6274      +29     
  Branches     1832     1827       -5     
==========================================
+ Hits         6029     6067      +38     
+ Misses        107      105       -2     
+ Partials      109      102       -7     
Impacted Files Coverage Δ
src/utils/PluginDriver.ts 100.00% <ø> (ø)
src/utils/options/mergeOptions.ts 100.00% <ø> (ø)
src/Bundle.ts 100.00% <100.00%> (ø)
src/Chunk.ts 100.00% <100.00%> (ø)
src/Graph.ts 100.00% <100.00%> (ø)
src/Module.ts 100.00% <100.00%> (+1.09%) ⬆️
src/ModuleLoader.ts 100.00% <100.00%> (ø)
src/ast/variables/NamespaceVariable.ts 100.00% <100.00%> (ø)
src/rollup/rollup.ts 100.00% <100.00%> (ø)
src/utils/FileEmitter.ts 100.00% <100.00%> (ø)
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2c7c4d7...c8b71ce. Read the comment docs.

@lukastaegert lukastaegert force-pushed the per-output-chunking branch 3 times, most recently from 7e82a1a to cc56021 Compare June 21, 2020 04:56
@lukastaegert lukastaegert marked this pull request as ready for review June 21, 2020 19:37
@lukastaegert
Copy link
Member Author

Documentation and cleanup are done, this is now ready for release

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.

getFileName returns incorrect result with multiple outputs inlineDynamicImports per output
2 participants