From 1c291dc7b076792492c76025cc4c1037222411c1 Mon Sep 17 00:00:00 2001 From: barbapapazes Date: Fri, 23 Aug 2024 16:53:18 +0200 Subject: [PATCH] feat(schema): add shared alias --- packages/schema/src/config/common.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/schema/src/config/common.ts b/packages/schema/src/config/common.ts index 07e3af834d..baaca9b4da 100644 --- a/packages/schema/src/config/common.ts +++ b/packages/schema/src/config/common.ts @@ -371,6 +371,11 @@ export default defineUntypedSchema({ */ plugins: 'plugins', + /** + * The shared directory. This directory is shared between the app and the server. + */ + shared: 'shared', + /** * The directory containing your static files, which will be directly accessible via the Nuxt server * and copied across into your `dist` folder when your app is generated. @@ -440,12 +445,13 @@ export default defineUntypedSchema({ */ alias: { $resolve: async (val: Record, get): Promise> => { - const [srcDir, rootDir, assetsDir, publicDir] = await Promise.all([get('srcDir'), get('rootDir'), get('dir.assets'), get('dir.public')]) as [string, string, string, string] + const [srcDir, rootDir, assetsDir, publicDir, sharedDir] = await Promise.all([get('srcDir'), get('rootDir'), get('dir.assets'), get('dir.public'), get('dir.shared')]) as [string, string, string, string, string] return { '~': srcDir, '@': srcDir, '~~': rootDir, '@@': rootDir, + '#shared': resolve(rootDir, sharedDir), [basename(assetsDir)]: resolve(srcDir, assetsDir), [basename(publicDir)]: resolve(srcDir, publicDir), ...val,