Skip to content

“Serializing big strings” warning with Webpack 5 filesystem cache #643

@andersk

Description

@andersk
  • Operating System: Linux
  • Node Version: 14.14.0
  • NPM Version: 6.14.8
  • webpack Version: 5.3.2
  • mini-css-extract-plugin Version: 1.2.1

Expected Behavior

No warnings.

Actual Behavior

When using Webpack 5 with cache: { type: "filesystem" }, mini-css-extract-plugin triggers this warning on sufficiently large CSS files: <w> [webpack.cache.PackFileCacheStrategy] Serializing big strings (194kiB) impacts deserialization performance (consider using Buffer instead and decode when needed).

Code

// webpack.config.js
const MiniCssExtractPlugin = require("mini-css-extract-plugin");

module.exports = {
  cache: { type: "filesystem" },
  entry: "bootstrap/dist/css/bootstrap.css",
  module: {
    rules: [
      { test: /\.css$/, use: [MiniCssExtractPlugin.loader, "css-loader"] },
    ],
  },
  plugins: [new MiniCssExtractPlugin()],
};

How Do We Reproduce?

$ npm i bootstrap css-loader mini-css-extract-plugin webpack webpack-cli

+ webpack-cli@4.1.0
+ css-loader@5.0.0
+ mini-css-extract-plugin@1.2.1
+ bootstrap@4.5.3
+ webpack@5.3.2
added 194 packages from 170 contributors, removed 157 packages, updated 6 packages and audited 201 packages in 7.192s

$ rm -rf .cache node_modules/.cache  # needed to reproduce more than once
$ npx webpack
[webpack-cli] Compilation finished
<w> [webpack.cache.PackFileCacheStrategy] Serializing big strings (194kiB) impacts deserialization performance (consider using Buffer instead and decode when needed)
asset main.css 194 KiB [compared for emit] (name: main)
asset main.js 0 bytes [compared for emit] [minimized] (name: main)
Entrypoint main 194 KiB = main.css 194 KiB main.js 0 bytes
./node_modules/bootstrap/dist/css/bootstrap.css 50 bytes [built] [code generated]
css ./node_modules/css-loader/dist/cjs.js!./node_modules/bootstrap/dist/css/bootstrap.css 194 KiB [code generated]
webpack 5.3.2 compiled successfully in 468 ms

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions