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

feat(nuxt): Support nuxt layers in a better way #2699

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from
Open

Conversation

marr
Copy link

@marr marr commented Jun 20, 2024

When using the pinia nuxt module with nuxt layers, there were some things that don't appear to work correctly.

I am trying to solve for a nuxt layer workflow, which adds the pinia module and registers some stores in the base layer. I want those stores to be available to my containing app, as well as stores that the containing app defines.

The issues I found with the current state of the module include:

  1. The pinia module tries to resolve pinia/dist/pinia.mjs from the containing app. This is problematic, because the layer is the one bringing the pinia dependency in. It should be using the distributable that the layer depends on.
  2. The stores directory in the layer gets lost when the containing app tries to register its own stores.
  3. Extending the layer should bring in the stores from the layer, and allow adding stores from the containing app.

I believe this PR solves those three problems. We remove some use of a deprecated API as well.

To add tests to this, I think I'd need to create a new "playground-layer" directory and extend from that in a new nuxt spec pertaining to layer functionality. If you agree with these changes, we can discuss if you'd like that as part of this.

Note: This may break nuxt 2 compatibility. I can try to add back support if this is a decent enough approach to fixing layer support.

Copy link

netlify bot commented Jun 20, 2024

Deploy Preview for pinia-playground canceled.

Name Link
🔨 Latest commit f4ec13b
🔍 Latest deploy log https://app.netlify.com/sites/pinia-playground/deploys/667965097c907f0008210a0f

Copy link

netlify bot commented Jun 20, 2024

Deploy Preview for pinia-official canceled.

Name Link
🔨 Latest commit f4ec13b
🔍 Latest deploy log https://app.netlify.com/sites/pinia-official/deploys/66796509ee7b290008cdb9cb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant