Skip to content

Commit 6a18c91

Browse files
committedJun 17, 2022
fix(cli): check dest path correctly (close #954)
1 parent 698e599 commit 6a18c91

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed
 

‎packages/@vuepress/cli/src/utils/resolveAppConfig.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { AppConfig } from '@vuepress/core'
22
import { ensureEndingSlash, ensureLeadingSlash } from '@vuepress/shared'
3-
import { chalk, logger, path } from '@vuepress/utils'
3+
import { chalk, isChildPath, logger } from '@vuepress/utils'
44

55
/**
66
* Resolve app config according to:
@@ -49,10 +49,7 @@ export const resolveAppConfig = ({
4949
)
5050
}
5151

52-
if (
53-
appConfig.dest &&
54-
path.normalize(appConfig.source).includes(path.normalize(appConfig.dest))
55-
) {
52+
if (appConfig.dest && isChildPath(appConfig.source, appConfig.dest)) {
5653
logger.warn(
5754
`${chalk.magenta('dest')} directory would be emptied during build,` +
5855
` so we fallback it to the default directory for the safety of your source files`

0 commit comments

Comments
 (0)
Please sign in to comment.