Skip to content
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

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

Closed
andersk opened this issue Dec 10, 2020 · 0 comments · Fixed by #665
Closed

Comments

@andersk
Copy link

andersk commented Dec 10, 2020

  • 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant