feat(schema): add shared alias

This commit is contained in:
barbapapazes 2024-08-23 16:53:18 +02:00
parent 8785ed43f6
commit 1c291dc7b0
1 changed files with 7 additions and 1 deletions

View File

@ -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<string, string>, get): Promise<Record<string, string>> => {
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,