rules skipped due to selector errors: legend+* -> Cannot read property 'type' of undefined
See original GitHub issueBug description:
When building angular using the production
configuration, the step Generating index html...
produces following warning:
1 rules skipped due to selector errors: legend+* -> Cannot read property 'type' of undefined
See this screenshot:
Reproduction Steps
In Terminal using Angular CLI:
ng new testproject --style scss
cd testproject
ng add @ng-bootstrap/ng-bootstrap
npm run build
Versions
Critters: 0.0.16
Angular: 13.3.0 - 13.3.2
ng-bootstrap: 12.0.2
Bootstrap: 5.1.3
Issue Analytics
- State:
- Created a year ago
- Reactions:13
- Comments:18 (2 by maintainers)
Top Results From Across the Web
Rules skipped due to selector errors: legend+* -> Cannot read ...
1 rules skipped due to selector errors: legend+* -> Cannot read property 'type' of undefined. See this screenshot:
Read more >Warning: 1 rules skipped due to selector errors: legend + ...
In the angular.json file write the following code, under "production". "optimization": { "scripts": true, "styles": { "minify": true, ...
Read more >Angular Universal 'Rules skipped due to selector errors' - Reddit
Angular Universal 'Rules skipped due to selector errors' ... legend+* -> Cannot read properties of undefined (reading 'type').
Read more >legend * -> cannot read properties of undefined (reading 'type')
This error occurs when attempting to read a property of an undefined variable. It typically means that the variable in question has not...
Read more >MDB4 with Angular12 css skipped rules
@Arkadiusz Idzikowski I upgraded to the next version and restored it to the original import, but the error still exists. 10 rules skipped...
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
I’ve had a closer look at this bug, and I now think it comes from an incompatibility between
parse5
which is used to parse HTML andcss-select
that is used to query CSS selectors. The document model is entirely different, and thuscss-select
try to access properties that never exist (node.prev
).It seems the most obvious solution would be to replace
parse5
withhtmlparser2
, because it is part of the same ecosystem ascss-select
. However that also means that the DOM mutation must be ported to something else, most likely todomutils
, and the same goes for the DOM serialization where the obvious choice would bedom-serializer
.All of that is a rather significant amount of work, and quite risky. It would probably be best if someone who know this codebase well would do it (instead of me)…
Getting the same (I think) with Tailwind typography plugin:
The only selectors, that error, seem to be with
+ *
in them.