-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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): supports automatic import of stores from extend layers #2828
base: v2
Are you sure you want to change the base?
feat(nuxt): supports automatic import of stores from extend layers #2828
Conversation
✅ Deploy Preview for pinia-playground canceled.
|
✅ Deploy Preview for pinia-official canceled.
|
@@ -101,6 +101,10 @@ const module: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({ | |||
if (options.storesDirs) { | |||
for (const storeDir of options.storesDirs) { | |||
addImportsDir(resolve(nuxt.options.rootDir, storeDir)) | |||
|
|||
for (const layer of nuxt.options._layers) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this an internal property? 😓 Let's use a public API
commit: |
I noticed there is also #2757, so let's use that one instead. Thanks for the PR! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## v2 #2828 +/- ##
=======================================
Coverage 89.34% 89.34%
=======================================
Files 14 14
Lines 1323 1323
Branches 218 219 +1
=======================================
Hits 1182 1182
Misses 140 140
Partials 1 1 ☔ View full report in Codecov by Sentry. |
When I install pinia in a nuxt layer and create
stores
folder, and then I extend this layer in another nuxt application, I find that thestores
are not automatically imported.What this PR does:
When addImportsDir, consider the nuxt layers also.
Refer:
Pinia autoImports for nuxt
Nuxt layers