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
Rollup v2.0.0 #3347
Rollup v2.0.0 #3347
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3347 +/- ##
==========================================
+ Coverage 93.29% 95.00% +1.71%
==========================================
Files 172 171 -1
Lines 6114 5831 -283
Branches 1823 1722 -101
==========================================
- Hits 5704 5540 -164
+ Misses 218 157 -61
+ Partials 192 134 -58
Continue to review full report at Codecov.
|
86f41ee
to
f4b9761
Compare
771189e
to
cfdc86b
Compare
Thank you for your contribution! ❤️You can try out this pull request locally by installing Rollup via
or load it into the REPL: |
f950ad5
to
a5c193d
Compare
91cff8f
to
bbfe4a5
Compare
q: wasnt |
Yes it was. The problem is that this caused an inconsistency with plugins that still receive "es" as format specifier, which was confusing to say the least. Asking around for opinions, I agree with the following reasoning:
So it is much more consistent with the other format specifiers. Nevertheless this is not a breaking change: |
I'm not convinced that bundling |
I see your point and we might revert this policy at some point. At the moment, bundling provides some slight size and parsing time advantages and allows for consistent behaviour between Node and browser builds. I usually try to be quick on updating merged dependencies, so unless you want to use a Github build this should not be too big an issue. Let's see how this pans out. |
1e393ef
to
8362f5b
Compare
Can you update |
Thanks for checking, this has actually already been done in one of the PRs included here: Line 12 in 3f1052b
|
* Update CI to only run on Node 10 and 12, add engines to package.json * Update TypeScript target * Remove Bublé as a transpilation option from tests (it is still needed in sourcemap tests) * Remove minNodeVersion form tests * Reformat package.json
* Create a separate chunk for watch mode via a dynamic import * Bundle chokidar * Handle conditional fsevents import * Only run tests on Node 10 and 12 as we want to do this anyway and chokidar depends on utils.promisify * Improve chunking * Refactor and simplify watcher * Make watcher a proper parameter * Only unwatch and watch on Linux systems * No longer run JS files through TypeScript for improved bundling performance
* Remove active deprecations * Make inactive deprecations active * Improve coverage * Improve coverage * Refine transformer * Improve coverage * Refactoring option normalization * Improve coverage
* Respect moduleSideEffects when inlining empty imports * Make dependencies a Set * Also handle side-effect free reexports correctly without generating separate chunks * Infer side-effect free modules and hoist side-effects * Simplify some logic * Better encapsulate chunk assignment * Get rid of colouring hashes * Improve coverage * Store the build output as artifact and post an automated comment
* [v2.0.0] Update minimum required Node version to 10 (#3346) * Update CI to only run on Node 10 and 12, add engines to package.json * Update TypeScript target * Remove Bublé as a transpilation option from tests (it is still needed in sourcemap tests) * Remove minNodeVersion form tests * Reformat package.json * [v2.0.0] Bundle chokidar (#3331) * Create a separate chunk for watch mode via a dynamic import * Bundle chokidar * Handle conditional fsevents import * Only run tests on Node 10 and 12 as we want to do this anyway and chokidar depends on utils.promisify * Improve chunking * Refactor and simplify watcher * Make watcher a proper parameter * Only unwatch and watch on Linux systems * No longer run JS files through TypeScript for improved bundling performance * [v2.0.0] Remove active deprecations (#3352) * Remove active deprecations * Make inactive deprecations active * Improve coverage * Improve coverage * Refine transformer * Improve coverage * Refactoring option normalization * Improve coverage * Remove experimentalOptimizeChunks * Remove more unused code
…encies (#3391) * Support Node ESM * Bundle acorn again, adjust directory structure and support Node ESM * Update dependencies * Collect licenses from all artifacts * Switch to colorette instead of turbocolor * Support Node ESM through conditional exports * Fix test
* Replace Buffer with UInt8Array and get rid of Node types dependency * Git rid of ESTree dependency by using a specialized version of acorn's Node type * Fix test and adjust documentation
* more explained error code for name-less umd bundle * Align error code with IIFE warning * Fix missing auth token issue. I guess we need to rethink how we post these messages as of course it makes sense CircleCI does not expose the token for different repo PRs for security reasons. Babel is using an AWS Lambda here, maybe something like that. Co-authored-by: Lukas Taegert-Atkinson <lukas.taegert-atkinson@tngtech.com>
a792bb1
to
eddb824
Compare
48731d7
to
b7523f0
Compare
Hey Lukas. Great work, and congratulations on the v2 milestone :-) Please let me know if you'd like me to create a new issue in relation to the following question. I'd like to understand if you have any plans for bringing back chunk grouping? For production applications built with Rollup with hundreds or thousands of chunks due to heavy use of code splitting, you might end up with many chunks weighing less than 1 kilobyte. My team is relying heavily on Rollup, but we're currently serving so many chunks to our users, most of which are less than or around 1kb in size, that it hurts performance. I've been following progress of the |
So to give you some idea, these are the topics I want to work on next:
However, it would take quite a bit of time to get there. For the time being, I would also have a look at manualChunks, which can basically be used to hand merge chunks. If all static entry points are always loaded together, one easy optimization could be to make all of them manual chunks. As a rule of thumb, an entry that is always loaded initially can always be made a manual chunk without risk. Manual chunks work like a flood fill paint, adding all statically imported modules to a chunk, unless they are already part of another manual chunk. |
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
See list of contained PRs at the bottom
Description
This is the release branch for Rollup@2.
See https://github.com/rollup/rollup/projects/2 for the current state of the new release.
At the moment, the following changes are contained in this branch:
Breaking Changes
Rollup now requires at least Node 10 to run, or a sufficiently modern browser ([v2.0.0] Update minimum required Node version to 10 #3346)
The file structure of Rollup's ESM builds has changed:
rollup/dist/es/rollup.js
instead ofrollup/dist/rollup.es.js
rollup/dist/es/rollup.browser.js
instead ofrollup/dist/rollup.browser.es.js
In general, the ESM builds now follow the same naming scheme as the CJS builds but are located in the
rollup/dist/es
subfolder instead ofrollup/dist
([v2.0.0] Bundle acorn, allow node ESM import fo Rollup, update dependencies #3391)The "watch.chokidar" option no longer accepts a
boolean
value but only an object of parameters that is passed to the bundled Chokidar instance. Chokidar installations by the user will be ignored in favour of the bundled instance ([v2.0.0] Bundle chokidar #3331)Modules that are completely tree-shaken will no longer be listed as part of any chunks in
generateBundle
The
experimentalOptimizeChunks
andchunkGroupingSize
options have been removedacorn plugins can only be used if they accept a passed-in acorn instance instead of importing it themselves. See Request: give token types and etc to plugins acornjs/acorn#870 (comment) for what needs to be done to make plugins compatible that do not support this yet ([v2.0.0] Bundle acorn, allow node ESM import fo Rollup, update dependencies #3391)
Emitted chunks now have the TypeScript type
UInt8Array
instead ofBuffer
. ABuffer
can still be used, though ([v2.0.0] Remove @types dependencies #3395)The TypeScript types no longer use ESTree types for AST nodes but a very generic type that does not contain information specific to certain node types ([v2.0.0] Remove @types dependencies #3395)
The signature of the
writeBundle
plugin hook has been changed to matchgenerateBundle
: The bundle object is now passed as second parameter instead of first and the first parameter is the output options ([v2.0.0] Change writeBundle signature to match generateBundle #3361)The following plugin hooks have been removed:
generateBundle
insteadwriteBundle
insteadrenderChunk
insteadrenderChunk
insteadYou can no longer access
this.watcher
on the plugin context.The
transform
hook can no longer returndependencies
.The
treeshake.pureExternalModules
option will now show a deprecation warning when used: usetreeshake.moduleSideEffects: 'no-external'
insteadUsing
import.meta.ROLLUP_ASSET_URL_<..>
andimport.meta.ROLLUP_CHUNK_URL_<..>
in code will now show warnings: useimport.meta.ROLLUP_FILE_URL_<..>
insteadThe
resolveAssetUrl
hook will now show a deprecation warning when used: useresolveFileUrl
insteadThe following plugin context functions will show warnings when used:
this.emitAsset
: usethis.emitFile
this.emitChunk
: usethis.emitFile
this.getAssetFileName
: usethis.getFileName
this.getChunkFileName
: usethis.getFileName
this.isExternal
: usethis.resolve
this.resolveId
: usethis.resolve
Directly adding properties to the bundle object in the
generateBundle
is deprecated will show a warning (removing properties is allowed, though): Usethis.emitFile
Accessing
chunk.isAsset
on the bundle is deprecated: Usechunk.type === 'asset'
insteadThe error code for a missing
name
property when targeting UMD has been changed toMISSING_NAME_OPTION_FOR_IIFE_EXPORT
to emphasize this is needed for the IIFE part of UMD (more explained error code for name-less umd bundle #3393)Features
import {rollup} from 'rollup'
. Note that this relies on Node's experimental conditional package exports feature and is therefore itself experimental ([v2.0.0] Bundle acorn, allow node ESM import fo Rollup, update dependencies #3391)systemjs
can be used as format alias forsystem
([v2.0.0] Rename "esm" to "es" in docs and errors #3381)Bug Fixes
Pull Requests
@types
dependencies (@lukastaegert)