Skip to content
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

Cannot use tailwind config on app.config #794

Closed
becem-gharbi opened this issue Jan 16, 2024 · 5 comments
Closed

Cannot use tailwind config on app.config #794

becem-gharbi opened this issue Jan 16, 2024 · 5 comments
Labels
bug Something isn't working has-workaround

Comments

@becem-gharbi
Copy link

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

@becem-gharbi becem-gharbi added the bug Something isn't working label Jan 16, 2024
@ineshbose
Copy link
Collaborator

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

@ineshbose
Copy link
Collaborator

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

@becem-gharbi
Copy link
Author

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)

@ineshbose
Copy link
Collaborator

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

@ineshbose ineshbose reopened this Jan 19, 2024
@becem-gharbi
Copy link
Author

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

This works well, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has-workaround
Projects
None yet
Development

No branches or pull requests

2 participants