-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Duplicate @import CSS rules cause undefined behaviour #8103
Comments
Thanks for the report! You're absolutely right — we should've been checking whether |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of Tailwind CSS are you using?
v3.0.24
What build tool (or framework if it abstracts the build tool) are you using?
vite 2.9.1
What version of Node.js are you using?
v16.11.0
What browser are you using?
N/A
What operating system are you using?
Linux
Reproduction URL
https:/jordimarimon/tailwindcss-duplicate-imports
Describe your issue
Hi!
First of all, thanks for this amazing library!
I am using a third party library that I can't modify and this library has duplicate
@import
CSS rules.Because of this duplicate
@import
CSS rules I get the following error from the Tailwind PostCSS plugin:In the repository that I have shared, after running
npm install
, there are three types of builds (see the NPM scripts in the package.json):@import
rule is not being resolvedpostcss-import
pluginIf you look at the
src/input.css
file you will see that I import two files that have the same@import
rule.If I remove or change one of the duplicate rules, the build works fine.
The problem I have, in my real project, is that the duplicate
@import
rules are from a third party library... and I can't modify it.I have cloned the TailwindCSS repository and link it locally to debug it and the line where I have found the problem is here:
https:/tailwindlabs/tailwindcss/blob/master/src/lib/collapseAdjacentRules.js#L32
It seems like
node.nodes
is undefined.Also, in my real project I'm not using Vite, I'm using the Angular CLI. The error also happens there.
The problem is solved if, in the TailwindCSS plugin, I check if
node.nodes
exist before callingcurrentRule.append(node.nodes)
.But I'm not sure if this is the correct solution. I'm not even sure if this is a problem of the TailwindCSS plugin.
The text was updated successfully, but these errors were encountered: