chore: throw error on assetsDir outside outDir

pull/3220/head
Divyansh Singh 1 year ago
parent 02161d0f79
commit a33831bf2c

@ -83,6 +83,18 @@ export async function resolveConfig(
? normalizePath(path.resolve(root, userConfig.cacheDir))
: resolve(root, 'cache')
const resolvedAssetsDir = normalizePath(path.resolve(outDir, assetsDir))
if (!resolvedAssetsDir.startsWith(outDir)) {
throw new Error(
[
`assetsDir cannot be set to a location outside of the outDir.`,
`outDir: ${outDir}`,
`assetsDir: ${assetsDir}`,
`resolved: ${resolvedAssetsDir}`
].join('\n ')
)
}
// resolve theme path
const userThemeDir = resolve(root, 'theme')
const themeDir = (await fs.pathExists(userThemeDir))

Loading…
Cancel
Save