-
-
Notifications
You must be signed in to change notification settings - Fork 384
“Serializing big strings” warning with Webpack 5 filesystem cache #643
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
Comments
Add |
@sokra That gave me more messages but no stack trace. $ npx webpack
[webpack.cache.PackFileCacheStrategy] No pack exists at /tmp/test/.cache/webpack/default-production.pack: Error: ENOENT: no such file or directory, open '/tmp/test/.cache/webpack/default-production/index.pack'
<t> [webpack.cache.PackFileCacheStrategy] restore cache container: 21.607204 ms
[webpack-cli] Compilation finished
[webpack.cache.PackFileCacheStrategy] Pack got invalid because of write to: ResolverCachePlugin|normal|dependencyType=|esm|path=|/tmp/test|request=|bootstrap/dist/css/bootstrap.css
[webpack.cache.PackFileCacheStrategy] Storing pack...
[webpack.cache.PackFileCacheStrategy] Capturing build dependencies... (/tmp/test/node_modules/webpack/lib/, /tmp/test/node_modules/css-loader/dist/cjs.js, /tmp/test/node_modules/mini-css-extract-plugin/dist/loader.js)
<t> [webpack.cache.PackFileCacheStrategy] resolve build dependencies: 448.126612 ms
<t> [webpack.cache.PackFileCacheStrategy] snapshot build dependencies: 18.92186 ms
[webpack.cache.PackFileCacheStrategy] Captured build dependencies
[webpack.cache.PackFileCacheStrategy] 20 fresh items in cache
<w> [webpack.cache.PackFileCacheStrategy] Serializing big strings (194kiB) impacts deserialization performance (consider using Buffer instead and decode when needed)
<t> [webpack.cache.PackFileCacheStrategy] store pack: 23.432643 ms
[webpack.cache.PackFileCacheStrategy] Stored pack
asset main.css 194 KiB [emitted] (name: main)
asset main.js 0 bytes [emitted] [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 402 ms However, by manually inserting a
where |
Thanks I think we can switch on buffer |
@sokra what do you think? |
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. |
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
How Do We Reproduce?
The text was updated successfully, but these errors were encountered: