You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 473b19e
Browse filesBrowse the repository at this point in the historyBrowse files
feat(performance): three more hints, and group the options before any ship (#21961)
* feat(performance): report loaders that drop the source map
A loader that rewrites code and returns no map leaves webpack mapping
positions to the loader's output as though it were the file on disk, so
every position below it is wrong and nothing says so. Rollup warns about
the same thing for plugins; webpack can also name which loaders ran.
* fix(asset): keep a bare import emitting when assets are side-effect-free
'futureDefaults' marks asset modules side-effect-free, which lets an
import whose binding nothing reads drop its file. A bare 'import "./x.png"'
declares no binding to read, so it dropped too — although emitting the
file is the only thing such an import can have been written for.
The two are told apart at the declaration, by a subclass rather than a
flag, so the shape of the far more common bound form is untouched and no
instance grows: both classes carry the same twenty fields. Over a
2000-module build the dependency count is unchanged (6400) and retained
heap does not rise.
* feat(performance): report assets emitted for an import nothing reads
An asset whose binding is never read still ships its file, and no check
said so: with every hint enabled the build reported nothing. What made it
reportable is that a bare import now has a class of its own, so wanting
the file on disk is told apart from having forgotten to use it.
Reported only when every incoming connection is an unread harmony import,
so a url(), a new URL() or an html src keeps the asset quiet. Inlined
assets carry no asset type and are left to the inlinedAssets check.
* feat(performance): report modules kept only by a side effect
Rollup answers "why is this still in my bundle" with the statement that
kept it; webpack computed the same thing and buried it in an optimization
bailout, which stats show only when asked and the cache does not restore.
The statement is now kept on buildInfo, so a cached build reports it too,
and written only when the hint is on: with it off no module carries the
field and retained heap is unchanged over a 2000-module build where every
module has a side effect (65.07-65.09 MB either way). Opting in costs
about 60 bytes per such module, 0.18 MB over those 2000.
* refactor(performance): group the hint options before any of them ship
None of the checks has been released, so the surface is still free to
change. Twenty-seven options where there were thirty-three:
- 'unusedConfig' replaces 'unusedAliases', 'unusedDefines',
'unusedExternals' and 'unusedRules'. Four switches for one finding —
configuration nothing used — where the fix is the same each time. Each
check keeps its own message.
- 'sourceMaps' replaces 'embeddedSourceMaps' and 'missingSourceMaps'.
- 'unusedModules' absorbs 'unusedReexports': the same module-nothing-uses
finding, told apart only by what kept it there, so each names its own
cause and neither reports what the other will.
- 'duplicateModules' absorbs 'entrypointOverlap', which was a strict
subset of it once the bug below was fixed.
'duplicateModules' counted chunks per module, so a module concatenated
into two entrypoints looked like it was in none and went unreported;
'entrypointOverlap' saw it only because it expanded concatenations. It
now expands them too, and names the entrypoints paying for each copy.
'unusedModules' reported every 'import "./polyfill"', which is deliberate
and was already ruled out for 'unusedReexports'. It now asks that some
importer bound a name, reusing the bare-import class, and skips modules
webpack left out — with no chunk there is no runtime, which is the only
place 'hasOnlyUnusedExports' reads usage.
* fix: declare the SideEffectsFlagPlugin recordStatement parameter
* fix: finish the performance option rename in statsCases
* fix: mark the new performance options as added in 5.111.0
* refactor: drop the unreachable bare-import evaluation override
* fix: keep the unused-modules fixtures on the node 10 baseline
* Report a production build whose 'devtool' writes the source map into the JavaScript, so everyone loading the page downloads it (requires 'hints' to be enabled).
3477
-
* @since 5.110.0
3478
-
*/
3479
-
embeddedSourceMaps?: boolean;
3480
-
/**
3481
-
* Report modules shipped by more than one entrypoint, which every page that loads them downloads again (requires 'hints' to be enabled).
3482
-
* @since 5.110.0
3483
-
*/
3484
-
entrypointOverlap?: boolean;
3485
3475
/**
3486
3476
* Report modules that call 'eval' directly, which stops minification, scope hoisting and tree shaking (requires 'hints' to be enabled).
* Report source maps that cost more than they give: a production 'devtool' that writes the map into the JavaScript, and modules a loader transformed without returning a map, which leaves positions pointing at the loader's output (requires 'hints' to be enabled).
3544
+
* @since 5.111.0
3545
+
*/
3546
+
sourceMaps?: boolean;
3552
3547
/**
3553
3548
* Report splits 'optimization.splitChunks' refused because 'maxInitialRequests' or 'maxAsyncRequests' was already reached (requires 'hints' to be enabled).
* Report 'resolve.alias' entries that no request matched.
3574
-
* @since 5.110.0
3575
-
*/
3576
-
unusedAliases?: boolean;
3577
-
/**
3578
-
* Report keys defined by 'DefinePlugin' that no module ever referenced, which cost a parser hook per module and invalidate the build when their value changes.
3579
-
* @since 5.110.0
3580
-
*/
3581
-
unusedDefines?: boolean;
3582
-
/**
3583
-
* Report requests listed in 'externals' that no module ever imported, which usually means the request is misspelled and the real one got bundled instead.
3584
-
* @since 5.110.0
3568
+
* Report asset files emitted for an import whose binding nothing reads, so the bytes ship for nothing (requires 'hints' to be enabled).
3569
+
* @since 5.111.0
3585
3570
*/
3586
-
unusedExternals?: boolean;
3571
+
unusedAssets?: boolean;
3587
3572
/**
3588
-
* Report modules bundled although nothing uses what they export, pulled in by a re-export (requires 'hints' to be enabled).
3589
-
* @since 5.110.0
3573
+
* Report configuration that no build used: 'resolve.alias' entries nothing matched, 'DefinePlugin' keys nothing referenced, 'externals' nothing imported, and 'module.rules' that never matched (requires 'hints' to be enabled).
3574
+
* @since 5.111.0
3590
3575
*/
3591
-
unusedReexports?: boolean;
3576
+
unusedConfig?: boolean;
3592
3577
/**
3593
-
* Report rules in 'module.rules' that never matched a module, which cost condition evaluation on every build. Note that plugins may add rules too, so a reported rule is not necessarily one you wrote.
3594
-
* @since 5.110.0
3578
+
* Report modules bundled although nothing uses what they export, naming the re-export or the side-effect statement that kept each one (requires 'hints' to be enabled).
3579
+
* @since 5.111.0
3595
3580
*/
3596
-
unusedRules?: boolean;
3581
+
unusedModules?: boolean;
3597
3582
}
3598
3583
/**
3599
3584
* Options affecting how file system snapshots are created and validated.
MIT License http://www.opensource.org/licenses/mit-license.php
0 commit comments