webpack-contrib / postcss-loader

PostCSS loader for webpack
MIT License
2.86k stars 211 forks source link

No serializer registered for Warning #653

Closed childrentime closed 1 year ago

childrentime commented 1 year ago

Bug report

postcss-loader will emit warnning when some css has ambiguity. But it will cause unstoppable yellow warning in terminal. It is because postcss-loader custom defined a Waring object and emit it with this.emitWarning

<w> [webpack.cache.PackFileCacheStrategy] Skipped not serializable cache item 'Compilation/modules|/Users/lianwenwu/work/demo/terser-react/custom-loader.js!/Users/lianwenwu/work/demo/terser-react/node_modules/css-loader/dist/cjs.js!/Users/lianwenwu/work/demo/terser-react/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].use[3]!/Users/lianwenwu/work/demo/terser-react/node_modules/sass-loader/dist/cjs.js!/Users/lianwenwu/work/demo/terser-react/src/index.scss': No serializer registered for Warning
<w> while serializing webpack/lib/cache/PackFileCacheStrategy.PackContentItems -> webpack/lib/NormalModule -> Array { 1 items } -> webpack/lib/ModuleWarning -> Warning

Actual Behavior

print waring in terminal even with stat: false

Expected Behavior

do not emit non-serializable object

How Do We Reproduce?

https://github.com/childrentime/webpack-cache-reproduce

Please paste the results of npx webpack info here, and mention other relevant information

  System:
    OS: macOS 13.3
    CPU: (10) arm64 Apple M1 Pro
    Memory: 226.13 MB / 16.00 GB
  Binaries:
    Node: 20.0.0 - ~/.nvm/versions/node/v20.0.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.6.4 - ~/.nvm/versions/node/v20.0.0/bin/npm
  Browsers:
    Chrome: 113.0.5672.126
    Safari: 16.4
  Packages:
    babel-loader: ^8.0.0 => 8.3.0 
    css-loader: ^6.7.4 => 6.7.4 
    postcss-loader: ^7.3.0 => 7.3.0 
    sass-loader: ^13.3.0 => 13.3.0 
    style-loader: ^3.3.3 => 3.3.3 
    terser-webpack-plugin: ^5.3.9 => 5.3.9 
    webpack: ^5.83.1 => 5.83.1 
    webpack-cli: ^5.1.1 => 5.1.1 
childrentime commented 1 year ago

https://github.com/webpack/webpack/issues/12458#issuecomment-1562223848

alexander-akait commented 1 year ago

Firstly

how should we fix it?

Only change options for autoprefixer, if postcss returns warnings we print them

The yellow warnings are really ugly.

Not sure what do you mean, yellow is default color for warnings

Even we solve problems with cache you will have these warnings in console until you fix your configuration

childrentime commented 1 year ago

Well, thanks a lot. Anyway I can't use it beacuse I currently use node12🥹. Ofcourse I know the yellow is default color for warnings, it's just bothering when seeing it.

alexander-akait commented 1 year ago

Just update node.js :smile:

digmen commented 6 months ago

System: OS: Windows 11 10.0.22621 CPU: (12) x64 AMD Ryzen 5 5500U with Radeon Graphics Memory: 1.54 GB / 7.33 GB Binaries: Node: 20.11.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.21 - ~\AppData\Roaming\npm\yarn.CMD npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Chromium (121.0.2277.83) Internet Explorer: 11.0.22621.1 Packages: webpack: ^5.90.0 => 5.90.0 webpack-cli: ^5.1.4 => 5.1.4