Skip to content

Commit a33831b

Browse files
committed
chore: throw error on assetsDir outside outDir
1 parent 02161d0 commit a33831b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Diff for: src/node/config.ts

+12
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,18 @@ export async function resolveConfig(
8383
? normalizePath(path.resolve(root, userConfig.cacheDir))
8484
: resolve(root, 'cache')
8585

86+
const resolvedAssetsDir = normalizePath(path.resolve(outDir, assetsDir))
87+
if (!resolvedAssetsDir.startsWith(outDir)) {
88+
throw new Error(
89+
[
90+
`assetsDir cannot be set to a location outside of the outDir.`,
91+
`outDir: ${outDir}`,
92+
`assetsDir: ${assetsDir}`,
93+
`resolved: ${resolvedAssetsDir}`
94+
].join('\n ')
95+
)
96+
}
97+
8698
// resolve theme path
8799
const userThemeDir = resolve(root, 'theme')
88100
const themeDir = (await fs.pathExists(userThemeDir))

0 commit comments

Comments
 (0)