Replies: 14 comments 6 replies
-
I found a workaround - I'm using gulp, so I just loaded my config into a javascript variable, then passed it into the tailwind constructor, rather than passing the config path to tailwind. I still think es6 module support would be awesome though
|
Beta Was this translation helpful? Give feedback.
-
To explicitly start the agent, import elastic-apm-node and call the apm. Start method with the agent configuration object. Type scripted it. If you're using. |
Beta Was this translation helpful? Give feedback.
-
With Next.js adding support for ESM projects, it's even more necessary now for Tailwind to support using an ESM config file. I'm unable to generate my Tailwind classes using PostCSS in an ESM Next.js project, and have to generate it manually using the Tailwind CLI. |
Beta Was this translation helpful? Give feedback.
-
This is also unfortunate for deno-based projects. Currently, I'm unable to import my Case in point: I'm actually using |
Beta Was this translation helpful? Give feedback.
-
@michaelhays how did you solve this? |
Beta Was this translation helpful? Give feedback.
-
Are there any plans on solving this? Ecosystem as a whole is migrating to ESM modules and the longer it isn't supported the more painful it is gonna be. postcss-load-config supports loading ESM modules for over a year now, so any news from Tailwind team about status of this feature would be welcome. |
Beta Was this translation helpful? Give feedback.
-
+1 for this. We have a monorepo that's mainly ESModules based. |
Beta Was this translation helpful? Give feedback.
-
you can use the following workaround for now.
import autoprefixer from 'autoprefixer'
import tailwind from 'tailwindcss'
import tailwindConfig from './tailwind.config.js'
export default {
plugins: [autoprefixer, tailwind(tailwindConfig)],
}
export default {
content: ['app/components/**/*.jsx'],
theme: {
extend: {},
},
plugins: [],
} |
Beta Was this translation helpful? Give feedback.
-
The officially supported way is to just make the config be You still won't be able to use ESM inside the file itself, but this will allow your project to be ESM, and the config be CJS. |
Beta Was this translation helpful? Give feedback.
-
There have been some nice workarounds suggested, but at the core I think most people on this thread just feel that modern js should have first-class support in modern libraries (to be fair, tailwind is unfortunately far from the only library that fails at allowing esm config). Sure, its not too hard to make it work. It's just annoying when your whole project is in ts and you have to then be adding linter exceptions to allow cjs syntax, not getting config validation, or having to find threads like this to work out how to translate the docs config examples to esm. I had been using the workaround I posted at the top here, but wanted to use the multiple config file approach introduced in 3.2 - no luck, I get "Cannot use import statement outside a module" (it assumes my config is not esm); so looks like i gotta move back to cjs... |
Beta Was this translation helpful? Give feedback.
-
@adamwathan I don't think this thread has had any response from a maintainer, and I think the number of upvotes (#3 in all-time top idea discussions) warrants at least some word - are there any plans for this feature in the roadmap, and if so, are we talking short-term or long-term? |
Beta Was this translation helpful? Give feedback.
-
Anyone find a workaround for using esm config with new |
Beta Was this translation helpful? Give feedback.
-
I found a workaround that resolved my problem. Maybe that could resolve your problem too. I couldn't import So, I let all variables that I need to use in |
Beta Was this translation helpful? Give feedback.
-
This is now fixed with https://tailwindcss.com/blog/tailwindcss-v3-3#esm-and-typescript-support |
Beta Was this translation helpful? Give feedback.
-
When my tailwind.config.js file is an ES Module, I get this below error while purging my css. This is a request to enable module support from tailwind.
Beta Was this translation helpful? Give feedback.
All reactions