Replies: 6 comments 9 replies
-
Totally open to adding this but not sure how to do it. Any suggestions or ideas that would save me time before researching it myself? We just started a new work cycle here at Tailwind the company so our plates are pretty full for the next 6 weeks before we are in a position to start prioritizing new projects for the next cycle. |
Beta Was this translation helpful? Give feedback.
-
You aren't actually limited to using CommonJS for You will lose out on Tailwind CSS IntelliSense though, and it's also worth mentioning You can see my thoughts where I was convinced to sacrifice ESM until Tailwind and PostCSS support it here. |
Beta Was this translation helpful? Give feedback.
-
Tailwind automatically picks up |
Beta Was this translation helpful? Give feedback.
-
I'm using tailwind in a next.js project. I got it working but "hidden" doesn't work and i can't understand why. Even in simple scenario like this : hello
"Hello" will show no matter what. And when i hover "hidden" in vs code i can this it is suppose to do display:none; which is what i want but it does not work :/ Any idea why ? (it's className because it's in a next.js project) |
Beta Was this translation helpful? Give feedback.
-
Hi |
Beta Was this translation helpful? Give feedback.
-
Do we need to wait until the v4 will be released? |
Beta Was this translation helpful? Give feedback.
-
ES Modules are the future, and many have realized this. NodeJS has introduced experimental esm support and popular players in open source are enforcing the use of them; for example, airbnb's widely known javascript style guide is already forbidding the use of non-standard module systems - this includes CommonJS.
To enable ESM support across my entire project, I set
"type": "module"
in mypackage.json
. Unfortunately, tailwindcss is one of the small number of postcss plugins that won't work in an esm environment. When I call it in mypostcss.config.js
as a plugin, it assumes that the tailwind config file,tailwind.config.js
, is a commonjs module, and attempts to require it (as opposed to importing it). I'd be extremely grateful if tailwind could introduce some kind of detection to tell esm and commonjstailwind.config.js
files apart, or just mandate the use of esm syntax and the.mjs
file extension for the tailwind config file as the default. ES Modules are the only true standard-conformant way of using modules, and even though they're in experimental support, they're also a lot nicer to work with and a migration to esm now would definitely prepare tailwindcss for the future.To clarify: this doesn't break tailwindcss for me. I only had to replace the file ending with
.cjs
in order for it to be treated as a commonjs module. But I have lost a few IDE features such as intellisense and the tailwind icon because of the different file ending, and I believe everyone should deserve esm modules without the hassle of a workaround.Beta Was this translation helpful? Give feedback.
All reactions