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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .lintstagedrc
Expand Up @@ -3,7 +3,7 @@
"prettier --write",
"tslint --project . --fix"
],
"test/**/*.ts": [
"test/typescript/**/*.ts": [
"prettier --write",
"tslint --project test/typescript --fix"
],
Expand Down
6 changes: 3 additions & 3 deletions docs/01-command-line-reference.md
Expand Up @@ -35,11 +35,8 @@ export default { // can be an array (for multiple inputs)

// advanced input options
cache,
inlineDynamicImports,
manualChunks,
onwarn,
preserveEntrySignatures,
preserveModules,
strictDeprecations,

// danger zone
Expand Down Expand Up @@ -73,11 +70,14 @@ export default { // can be an array (for multiple inputs)
extend,
footer,
hoistTransitiveImports,
inlineDynamicImports,
interop,
intro,
manualChunks,
minifyInternalExports,
outro,
paths,
preserveModules,
sourcemap,
sourcemapExcludeSources,
sourcemapFile,
Expand Down
6 changes: 3 additions & 3 deletions docs/02-javascript-api.md
Expand Up @@ -83,11 +83,8 @@ const inputOptions = {

// advanced input options
cache,
inlineDynamicImports,
manualChunks,
onwarn,
preserveEntrySignatures,
preserveModules,
strictDeprecations,

// danger zone
Expand Down Expand Up @@ -129,11 +126,14 @@ const outputOptions = {
externalLiveBindings,
footer,
hoistTransitiveImports,
inlineDynamicImports,
interop,
intro,
manualChunks,
minifyInternalExports,
outro,
paths,
preserveModules,
sourcemap,
sourcemapExcludeSources,
sourcemapFile,
Expand Down
2 changes: 1 addition & 1 deletion docs/04-tutorial.md
Expand Up @@ -282,7 +282,7 @@ var version=function(){"use strict";var n="1.0.0";return function(){console.log(

### Code Splitting

For code splitting, there are cases where Rollup splits code into chunks automatically, like dynamic loading or multiple entry points, and there is a way to explicitly tell Rollup which modules to split into separate chunks via the [`manualChunks`](guide/en/#manualchunks) option.
For code splitting, there are cases where Rollup splits code into chunks automatically, like dynamic loading or multiple entry points, and there is a way to explicitly tell Rollup which modules to split into separate chunks via the [`output.manualChunks`](guide/en/#outputmanualchunks) option.

To use the code splitting feature to achieve the lazy dynamic loading (where some imported module(s) is only loaded after executing a function), we go back to the original example and modify `src/main.js` to load `src/foo.js` dynamically instead of statically:

Expand Down
4 changes: 2 additions & 2 deletions docs/06-faqs.md
Expand Up @@ -61,7 +61,7 @@ With this optimization, a JavaScript engine will discover all transitive depende
2. Load and parse `other-entry.js` and `external`. The import of `other-entry.js` is already loaded and parsed.
3. Execute `main.js`.

There may be situations where this optimization is not desired, in which case you can turn it off via the [`output.hoistTransitiveImports`](guide/en/#outputhoisttransitiveimports) option. This optimization is also never applied when using the [`preserveModules`](guide/en/#preservemodules) option.
There may be situations where this optimization is not desired, in which case you can turn it off via the [`output.hoistTransitiveImports`](guide/en/#outputhoisttransitiveimports) option. This optimization is also never applied when using the [`output.preserveModules`](guide/en/#outputpreservemodules) option.

#### How do I add polyfills to a Rollup bundle?

Expand Down Expand Up @@ -94,7 +94,7 @@ For most code this is not a problem, because Rollup can guarantee:
This is however a problem for polyfills, as those usually need to be executed first but it is usually not desired to place an import of the polyfill in every single module. Luckily, this is not needed:

1. If there are no external dependencies that depend on the polyfill, it is enough to add an import of the polyfill as first statement to each static entry point.
2. Otherwise, additionally making the polyfill a separate entry or [manual chunk](guide/en/#manualchunks) will always make sure it is executed first.
2. Otherwise, additionally making the polyfill a separate entry or [manual chunk](guide/en/#outputmanualchunks) will always make sure it is executed first.

#### Is Rollup meant for building libraries or applications?

Expand Down
300 changes: 154 additions & 146 deletions docs/999-big-list-of-options.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion rollup.config.js
Expand Up @@ -99,7 +99,8 @@ export default command => {
],
treeshake,
manualChunks: { rollup: ['src/node-entry.ts'] },
strictDeprecations: true,
// TODO set this to `true` again once manualChunks has been moved to the output
strictDeprecations: false,
output: {
banner,
chunkFileNames: 'shared/[name].js',
Expand Down