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

Nuxt Layers and FormKit theme #1279

Closed
Archetipo95 opened this issue Mar 21, 2024 · 6 comments
Closed

Nuxt Layers and FormKit theme #1279

Archetipo95 opened this issue Mar 21, 2024 · 6 comments
Labels
🐛 bug-report Bug is reported, but not verified by team ⛑ Needs triage The issue has not yet been examined by the FormKit team.

Comments

@Archetipo95
Copy link
Contributor

Reproduction

https://github.com/Archetipo95/test-formkit-theme

Describe the bug

I'm trying to use Nuxt Layers feature (https://nuxt.com/docs/getting-started/layers) with FormKit, but it seams that the theme is not working.
I made a repo for reproduction (https://github.com/Archetipo95/test-formkit-theme), I started from official Nuxt Layer starter (https://github.com/nuxt/starter/tree/layer).

I tried without layer configuration and the theme is working as expected.

To start the repo use pnpm i and pnpm dev

If you want to try with normal configuration without the nuxt layer:
1- change tsconfig.json to "extends": "./.nuxt/tsconfig.json"
2- use the command pnpm nuxt dev

This is the conversation I had on the support forum with @fenilli https://discord.com/channels/793529058377072650/1220439418943311912

Environment

MacOs

@Archetipo95 Archetipo95 added ⛑ Needs triage The issue has not yet been examined by the FormKit team. 🐛 bug-report Bug is reported, but not verified by team labels Mar 21, 2024
@challapradyumna
Copy link

Part of the issue is that dependencies of the layers are not automatically installed in the extended nuxt installation.

nuxt/nuxt#13367 (comment)
unjs/c12#51

Another part of the issue is that content files in tailwind.config.js are relative to the root directory of the extended nuxt installation not the layer. Hence the join in layer nuxt.config.js for CSS file.

https://codesandbox.io/p/devbox/bold-cdn-ddcyqc

@Archetipo95
Copy link
Contributor Author

Thanks for the info about the issues. I'm not getting your proposed solution, did you just duplicate your code from the base layer?

@Archetipo95
Copy link
Contributor Author

Also this could be linked to our issue: nuxt-modules/tailwindcss#826

@challapradyumna
Copy link

  • Duplicated formkit.config.ts formkit.theme.ts
  • Installed and registered @formkit/nuxt module in playground.

@Archetipo95
Copy link
Contributor Author

I guess I found that a good solution is just putting configFile: join(currentDir, './formkit.config.ts'), in the nuxt.config under FormKit settings.
I don't know why but it's working. I updated the reproduction code so you can check it.
I will leave this issue open for now, I anyone from the FormKit team wants to check what's going on.

@fenilli
Copy link
Contributor

fenilli commented Mar 28, 2024

The way the nuxt module works is by looking into resolved path of the nuxt.options.rootDir + options.configFile || 'formkit.config' I would guess using nuxt layers this would make nuxt.options.rootDir as the extension path, not the layer path, by adding a configFile with currentDir it probably resolves correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug-report Bug is reported, but not verified by team ⛑ Needs triage The issue has not yet been examined by the FormKit team.
Projects
None yet
Development

No branches or pull requests

3 participants