webpack v5.0.0-beta.23 Release Notes

Release Date: 2020-08-02 // about 2 years ago
  • Highlights

    ⚡️ webpack now optimizes exports and concatenates modules per runtime (often equal entrypoint), which will lead to better optimization when using multiple entrypoints.
    Entrypoints do no longer affect each other when using a runtime per entrypoint.

    ⚡️ webpack defaults has been improved to be optimized for http/2 serving (creating more chunks as request limit as been increased).

    🔋 Features

    • 🆕 new option splitChunks.enforceSizeThreshold resp. splitChunks.cacheGroups[x].enforceSizeThreshold
      • when over this limit, minRemainingSize, maxInitialRequests and maxAsyncRequests are ignore
      • This enforces big chunks to be splitted, e. g. big vendors, even if this adds more requests or keeps small remaining chunks
    • ➕ added compilation/compiler.getCache API for easier to use caching
      • also exposes getLazyHashedEtag to plugins
    • 👍 Allow to use "..." in more configuration options to access the defaults:
      0️⃣ cache.managed/immutablePaths, module.defaultRules, optimization.minimizer
    • 🍱 assets now use a content hash instead of the module hash
    • 👌 improved the experiments.mjs to mirror node.js behavior
      • type: "module"
      • *.cjs and *.mjs
      • data:text/javascript and data:application/javascript
      • Disallow not fully specified requests in imports from these types
    • ➕ add Rule.descriptionData to allow matching data from the package.json
    • ➕ add support for parsing and evaluating ?? expressions
    • ➕ add entry[x].runtime option to set runtimeChunk set entry
    • optimization.usedExports now analyses used exports separately per runtime to allow independent optimization
      • add "global" option to optimization.usedExports analyse used exports globally instead (faster)
    • ⚡️ optimization.concatenateModules now optimizes per runtime when analysed by optimization.usedExports
    • ➕ add splitChunks.usedExports resp. splitChunks.cacheGroups[x].usedExports to compare modules based on used exports or ignore them while comparing
      • This is relevant when looking for shared module to combine them in a chunk. When enabled modules will only be considered as equal when used exports match.
      • false is usually better for long term caching and a smaller total size
      • true is usually better for load performance of individual pages.
      • This is enabled by default in production mode.
    • ➕ add optimization.mangleExports: "size" to optimize export names for minimal size
    • give useful error message when using runtime or dependOn incorrectly in entry
    • 👌 improve --progress and --progress --profile output
    • 🏗 store build dependencies and store cache after finishing the compilation in watch mode to avoid adding extra delay

    🔄 Changes

    • 0️⃣ splitChunks.minSize defaults to 20k in production
    • 0️⃣ splitChunks.enforceSizeThreshold defaults to 50k in production
    • 🗄 using compilation.cache directly is now deprecated
    • 🗄 deprecate optimization.noEmitOnErrors in favor of optimization.emitOnErrors
      • negative flags can be confusing

    🛠 Bugfixes

    • 👌 improve the merging of resolve options to apply byDependency in the correct order as specified
    • calling compiler.close multiple times will still call all callbacks correctly
    • Compiler.hooks.invalid will now also be triggered when manually invalidating the watching
    • 🛠 fix passing externalsType via configuration
    • ➕ add webpack-cli as optional peer dependency to allow using it with Yarn 2
    • 🛠 fix display for built time in stats at 10 o'clock