Skip to content

Commit 6f10ed6

Browse files
authoredJul 2, 2020
fix: use resolve instead of join (#33)
Allows the documentation to exist in a folder e.g. `docs`, and running `vitepress dev docs` as well as `vitepress build docs`
1 parent b127eed commit 6f10ed6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed
 

Diff for: ‎bin/vitepress.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ console.log(chalk.cyan(`vitepress v${require('../package.json').version}`))
66
console.log(chalk.cyan(`vite v${require('vite/package.json').version}`))
77

88
const command = argv._[0]
9+
const root = argv._[command ? 1 : 0]
10+
if (root) {
11+
argv.root = root
12+
}
913

1014
if (!command || command === 'dev') {
1115
const port = argv.port || 3000
12-
const root = command === 'dev' && argv._[1]
13-
if (root) {
14-
argv.root = root
15-
}
1616
require('../dist/node')
1717
.createServer(argv)
1818
.then((server) => {

Diff for: ‎src/node/build/render.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function resolvePageImports(
8484
// find the page's js chunk and inject script tags for its imports so that
8585
// they are start fetching as early as possible
8686

87-
const srcPath = path.join(config.root, page)
87+
const srcPath = path.resolve(config.root, page)
8888
const pageChunk = result.assets.find(
8989
(chunk) => chunk.type === 'chunk' && chunk.facadeModuleId === srcPath
9090
) as OutputChunk

0 commit comments

Comments
 (0)