From 853174c443c36a52181fc9f00adfff0f32014ba1 Mon Sep 17 00:00:00 2001 From: wzc520pyfm <1528857653@qq.com> Date: Sun, 10 Nov 2024 01:33:19 +0800 Subject: [PATCH 1/2] feat(nuxt): supports automatic import of folder in extend layers --- packages/nuxt/src/module.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/nuxt/src/module.ts b/packages/nuxt/src/module.ts index b425bda4e4..ed1684a37f 100644 --- a/packages/nuxt/src/module.ts +++ b/packages/nuxt/src/module.ts @@ -101,6 +101,10 @@ const module: NuxtModule = defineNuxtModule({ if (options.storesDirs) { for (const storeDir of options.storesDirs) { addImportsDir(resolve(nuxt.options.rootDir, storeDir)) + + for (const layer of nuxt.options._layers) { + addImportsDir(resolve(layer.config.rootDir, storeDir)) + } } } }, From 3f4442f71dc5b67f0d1479ab81f09ea59e340ef0 Mon Sep 17 00:00:00 2001 From: wzc520pyfm <1528857653@qq.com> Date: Sun, 10 Nov 2024 01:37:44 +0800 Subject: [PATCH 2/2] chore(nuxt): add extend layer example for automatically imports folder --- packages/nuxt/playground/play-extends-layer/app.vue | 6 ++++++ .../nuxt/playground/play-extends-layer/nuxt.config.ts | 9 +++++++++ packages/nuxt/playground/play-extends-layer/package.json | 8 ++++++++ .../nuxt/playground/play-extends-layer/tsconfig.json | 3 +++ packages/nuxt/playground/tsconfig.json | 3 ++- 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 packages/nuxt/playground/play-extends-layer/app.vue create mode 100644 packages/nuxt/playground/play-extends-layer/nuxt.config.ts create mode 100644 packages/nuxt/playground/play-extends-layer/package.json create mode 100644 packages/nuxt/playground/play-extends-layer/tsconfig.json diff --git a/packages/nuxt/playground/play-extends-layer/app.vue b/packages/nuxt/playground/play-extends-layer/app.vue new file mode 100644 index 0000000000..c0a035c97d --- /dev/null +++ b/packages/nuxt/playground/play-extends-layer/app.vue @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/packages/nuxt/playground/play-extends-layer/nuxt.config.ts b/packages/nuxt/playground/play-extends-layer/nuxt.config.ts new file mode 100644 index 0000000000..0ae4393e72 --- /dev/null +++ b/packages/nuxt/playground/play-extends-layer/nuxt.config.ts @@ -0,0 +1,9 @@ +import { defineNuxtConfig } from 'nuxt/config' + +export default defineNuxtConfig({ + extends: ['..'], + + devtools: { enabled: true }, + + compatibilityDate: '2024-09-26', +}) diff --git a/packages/nuxt/playground/play-extends-layer/package.json b/packages/nuxt/playground/play-extends-layer/package.json new file mode 100644 index 0000000000..91a3de0972 --- /dev/null +++ b/packages/nuxt/playground/play-extends-layer/package.json @@ -0,0 +1,8 @@ +{ + "private": true, + "type": "module", + "name": "pinia-nuxt-playground-extends-layer", + "scripts": { + "dev": "nuxt dev" + } +} diff --git a/packages/nuxt/playground/play-extends-layer/tsconfig.json b/packages/nuxt/playground/play-extends-layer/tsconfig.json new file mode 100644 index 0000000000..4b34df1571 --- /dev/null +++ b/packages/nuxt/playground/play-extends-layer/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "./.nuxt/tsconfig.json" +} diff --git a/packages/nuxt/playground/tsconfig.json b/packages/nuxt/playground/tsconfig.json index 4b34df1571..39333429c3 100644 --- a/packages/nuxt/playground/tsconfig.json +++ b/packages/nuxt/playground/tsconfig.json @@ -1,3 +1,4 @@ { - "extends": "./.nuxt/tsconfig.json" + "extends": "./.nuxt/tsconfig.json", + "exclude": ["./play-extends-layer"] }