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

Empty @layer declaration leads to Cannot read properties of undefined (reading 'length)') #239

Closed
GreenTea124 opened this issue Jul 23, 2023 · 1 comment · Fixed by #255

Comments

@GreenTea124
Copy link

Bug report

You should be able to define CSS layers like this:

@layer ui-components;

And like this:

@layer ui-components {
}

Actual Behavior

2nd syntax works fine, 1st syntax leads to this error:

ERROR in _webpack/css/867a6d3b57e2ee85e279.css
_webpack/css/867a6d3b57e2ee85e279.css from Css Minimizer plugin
TypeError: Cannot read properties of undefined (reading 'length')
    at equals (C:\Users\xyz\node_modules\postcss-discard-duplicates\src\index.js:72:36)
    at dedupe (C:\Users\xyz\node_modules\postcss-discard-duplicates\src\index.js:148:7)
    at OnceExit (C:\Users\xyz\node_modules\postcss-discard-duplicates\src\index.js:161:7)
    at LazyResult.runAsync (C:\Users\xyz\node_modules\postcss\lib\lazy-result.js:326:21)
    at async cssnanoMinify (eval at transform (C:\Users\xyz\node_modules\css-minimizer-webpack-plugin\dist\minify.js:67:28), <anonymous>:78:18)
    at async minify (C:\Users\xyz\node_modules\css-minimizer-webpack-plugin\dist\minify.js:33:26)
webpack-web 

Expected Behavior

Both syntaxes should work.

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

  System:
    OS: Windows 10
  Binaries:
    Node: 18.16.0 - C:\Program Files\nodejs\node.EXE
    npm: 9.7.2 - C:\Program Files\nodejs\npm.CMD
@ludofischer
Copy link
Contributor

This might be fixed by updating cssnano to 6.0.4. Unfortunately, I would need the exact code sample triggering the error to verify it is really fixed.

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.

2 participants