nuxt-modules / tailwindcss

Tailwind CSS module for Nuxt

Home Page:https://tailwindcss.nuxtjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot use tailwind config on `app.config`

becem-gharbi opened this issue · comments

Version

@nuxtjs/tailwindcss: v6.10.4
nuxt: v3.9.1

Reproduction Link

https://stackblitz.com/edit/github-aowrfw?file=nuxt.config.ts

Steps to reproduce

Run the application npm run dev and check the terminal.

What is Expected?

The application should start and the tailwind configuration accessible on app.config file.

What is actually happening?

The application failed to start and the error below is thrown. This only applies to app.config and not when importing from vue components.

Capture d’écran 2024-01-16 091305

Valid issue. Thanks for reporting and providing a reproduction; let me investigate and get back to you. 🙂

I want to investigate this further, but I've added a workaround if you'd like to test on nightly release, set exposeConfig.write to true

Hi @ineshbose, I have tested the nightly release however the issue still exists. I pasted the linux and windows logs below to help. Thanks for your time!

Linux

[08:06:08] ERROR [worker reload] [worker init] Directory import '/home/projects/github-aowrfw/.nuxt/tailwind.config' is not supported resolving ES modules imported from /home/projects/github-aowrfw/.nuxt/dev/index.mjs

at _node_internal (https://githubaowrfw-fuki.w-credentialless.staticblitz.com/blitz.babcaeac.js:36:5406)
at new (https://githubaowrfw-fuki.w-credentialless.staticblitz.com/blitz.babcaeac.js:36:4168)
at https://githubaowrfw-fuki.w-credentialless.staticblitz.com/blitz.babcaeac.js:114:11863
at https://githubaowrfw-fuki.w-credentialless.staticblitz.com/blitz.babcaeac.js:114:12159
at defaultResolve (https://githubaowrfw-fuki.w-credentialless.staticblitz.com/blitz.babcaeac.js:114:12167)
at nextResolve (https://githubaowrfw-fuki.w-credentialless.staticblitz.com/blitz.babcaeac.js:248:2120)
at ESMLoader.resolve (https://githubaowrfw-fuki.w-credentialless.staticblitz.com/blitz.babcaeac.js:248:7556)
at ESMLoader.getModuleJob (https://githubaowrfw-fuki.w-credentialless.staticblitz.com/blitz.babcaeac.js:248:4387)
at https://githubaowrfw-fuki.w-credentialless.staticblitz.com/blitz.babcaeac.js:181:932
at _0x560a95.link (https://githubaowrfw-fuki.w-credentialless.staticblitz.com/blitz.babcaeac.js:352:381444)
at https://githubaowrfw-fuki.w-credentialless.staticblitz.com/blitz.babcaeac.js:181:893

Windows

[08:05:24] ERROR [worker reload] [worker init] Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
at new NodeError (node:internal/errors:405:5)
at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:136:11)
at defaultLoad (node:internal/modules/esm/load:87:3)
at nextLoad (node:internal/modules/esm/loader:163:28)
at ESMLoader.load (node:internal/modules/esm/loader:603:26)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:22)
at new ModuleJob (node:internal/modules/esm/module_job:64:26)
at #createModuleJob (node:internal/modules/esm/loader:480:17)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:434:34)
at async ModuleWrap. (node:internal/modules/esm/module_job:79:21)

I forgot to mention that after you use exposeConfig.write: true, also update the import statement to import theme from '#tailwind-config/theme.mjs'

update the import statement to import theme from '#tailwind-config/theme.mjs'

This works well, thanks!