“Serializing big strings” warning with Webpack 5 filesystem cache
See original GitHub issue- 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
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Another “Serializing big strings” warning with Webpack 5 ...
Another “Serializing big strings” warning with Webpack 5 filesystem cache and source maps.
Read more >Build error while migrating gatsby from version 2 to 4
... Engines <w> [webpack.cache.PackFileCacheStrategy] Serializing big strings (2076kiB) impacts deserialization performance (consider using ...
Read more >mini-css-extract-plugin | Yarn - Package Manager
webpack -contrib52.6mMIT2.7.2TS. extracts CSS into separate ... Bug Fixes. serializing big strings in sourceMap (#665 (f7a5e53) ... December 5, 2022: 2.7.2.
Read more >package (#168831) · Jobs · ReactWeb5 / CivWeb · GitLab
PackFileCacheStrategy ] Serializing big strings (875kiB) impacts deserialization performance ... Array { 1 items } -> webpack/lib/ModuleWarning -> Warning
Read more >webpack @ 5.0.0-beta.12 .. 5.0.0-beta.13 - Package Diff
makeSerializable(Pack, "webpack/lib/cache/PackFileCacheStrategy", "Pack"); ... return size + 5 + element. ... `Serializing big strings (${Math.round(.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yep use a Buffer. Convert to buffer during parsing. Convert from buffer to string during code generation.
Parsing is only done once. Code generation will be skipped if the css output file doesn’t change. This way no utf-8 conversion is needed, buffer never have to be decoded to a string.
@sokra what do you think?