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

Does not work with Nuxt Layers setup #84

Open
maoberlehner opened this issue Oct 27, 2023 · 1 comment
Open

Does not work with Nuxt Layers setup #84

maoberlehner opened this issue Oct 27, 2023 · 1 comment
Labels
bug Something isn't working layers

Comments

@maoberlehner
Copy link

maoberlehner commented Oct 27, 2023

Environment

  • Operating System: Darwin
  • Node Version: v18.15.0
  • Nuxt Version: 3.8.0
  • CLI Version: 3.9.1
  • Nitro Version: 2.7.1
  • Package Manager: npm@9.5.0
  • Builder: -
  • User Config: devServer, extends, vite
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/nuxt-starter-vdvjhb?file=nuxt.config.ts

Describe the bug

When using the module inside of a Nuxt Layer (https://nuxt.com/docs/getting-started/layers) the server action does not work.

In the reproduction above, we have a root application extending another application inside my-layer. my-layer uses the module. But when opening the /login page and submitting the form, nothing happens.

Additional context

No response

Logs

No response

@Hebilicious
Copy link
Owner

Hebilicious commented Oct 30, 2023

Hi @maoberlehner, thanks for using this module and opening this issue. I have not tested it with layers, and unfortunately it seems we need some layer specific logic within the module to handle this use case.
I will investigate it as soon as I have time, and see how we can make this work.

I suspect that here

const actionDirectoryPath = resolve(nuxt.options.srcDir, "server/actions")

we should try to detect actions that are located within layers.

@danielroe tagging you here, could we introduce a kit utility that resolves a path for all layers, or something to help in this scenario (https://nuxt.com/docs/guide/going-further/layers#multi-layer-support-for-nuxt-modules maybe) ? Or should modules that reads the filesystem handle layers separately ?

@Hebilicious Hebilicious added bug Something isn't working layers and removed pending triage labels Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working layers
Projects
None yet
Development

No branches or pull requests

2 participants