tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

import.meta.resolve doesn't work in the tailwind.config file

Open mkeyy0 opened this issue 1 year ago • 2 comments

What version of Tailwind CSS are you using?

v3.4.10

What build tool (or framework if it abstracts the build tool) are you using?

vite 5.3.4, vue 3.4.31

What version of Node.js are you using?

v20.12.0

What operating system are you using?

macOS

Reproduction URL

Describe your issue

Tailwind doesn't support ESM natively and uses some tools to achieve that. And for some properties of import.meta like url works nice, but in my case, I need to use import.meta.resolve to resolve the path to my monorepo UI library in node_modules. I know that I can use require.resolve as a workaround, but I'm not sure that is a good way to mix esm and cjs globals. So for me, it would be nice to add support of import.meta.resolve to the tailwind.config file

mkeyy0 avatar Sep 14 '24 16:09 mkeyy0

It's the same issue for me. Thanks for reporting, and waiting for the TailwindCSS team to respond.

Angelovsky avatar Oct 09 '24 08:10 Angelovsky

@mkeyy0 @Angelovsky kindly assign this issue to me

aakashsharma7 avatar Jun 03 '25 06:06 aakashsharma7

This is/was happening because we use Jiti to compile things and it has to defer to Node.js itself to support this and can't b/c require(…).

I've made some tweaks which will go out in 3.4.18 which will allow this to work so long as the config is loadable via require(esm) on a new enough version of Node.js.

thecrypticace avatar Sep 16 '25 18:09 thecrypticace