Skip to content

Commit

Permalink
fix: use resolve instead of join (vuejs#33)
Browse files Browse the repository at this point in the history
Allows the documentation to exist in a folder e.g. `docs`, and running `vitepress dev
docs` as well as `vitepress build docs`
  • Loading branch information
yexiaoking authored and veaba committed Jul 2, 2020
1 parent 4758709 commit ad9ba7d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions bin/vitepress.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ console.log(chalk.cyan(`vitepress v${require('../package.json').version}`))
console.log(chalk.cyan(`vite v${require('vite/package.json').version}`))

const command = argv._[0]
const root = argv._[command ? 1 : 0]
if (root) {
argv.root = root
}

if (!command || command === 'dev') {
const port = argv.port || 3000
const root = command === 'dev' && argv._[1]
if (root) {
argv.root = root
}
require('../dist/node')
.createServer(argv)
.then((server) => {
Expand Down
2 changes: 1 addition & 1 deletion src/node/build/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function resolvePageImports(
// find the page's js chunk and inject script tags for its imports so that
// they are start fetching as early as possible

const srcPath = path.join(config.root, page)
const srcPath = path.resolve(config.root, page)
const pageChunk = result.assets.find(
(chunk) => chunk.type === 'chunk' && chunk.facadeModuleId === srcPath
) as OutputChunk
Expand Down

0 comments on commit ad9ba7d

Please sign in to comment.