Skip to content

Another “Serializing big strings” warning with Webpack 5 filesystem cache and source maps #663

Closed
@andersk

Description

@andersk
  • Operating System: Linux
  • Node Version: 14.15.1
  • NPM Version: 6.14.8
  • webpack Version: 5.10.0
  • mini-css-extract-plugin Version: 1.3.2

Expected Behavior

No warnings.

Actual Behavior

(This is a sequel to #643, where the case without source maps was fixed.)

When using Webpack 5 with cache: { type: "filesystem" } and css-loader with sourceMap: true, mini-css-extract-plugin triggers this warning on sufficiently large CSS files: <w> [webpack.cache.PackFileCacheStrategy] Serializing big strings (175kiB) 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,
          { loader: "css-loader", options: { sourceMap: true } },
        ],
      },
    ],
  },
  plugins: [new MiniCssExtractPlugin()],
};

How Do We Reproduce?

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

+ mini-css-extract-plugin@1.3.2
+ bootstrap@4.5.3
+ css-loader@5.0.1
+ webpack-cli@4.2.0
+ webpack@5.10.0
added 167 packages from 171 contributors and audited 167 packages in 9.398s

$ rm -rf .cache node_modules/.cache
$ npx webpack
[webpack-cli] Compilation finished
<w> [webpack.cache.PackFileCacheStrategy] Serializing big strings (175kiB) 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??ruleSet[1].rules[0].use[1]!./node_modules/bootstrap/dist/css/bootstrap.css 194 KiB [code generated]
webpack 5.10.0 compiled successfully in 565 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