Skip to content

fix: use resolve instead of join #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bin/vitepress.js
Original file line number Diff line number Diff line change
@@ -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) => {
2 changes: 1 addition & 1 deletion src/node/build/render.ts
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/node/config.ts
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ export interface SiteConfig<ThemeConfig = any> {
}

const resolve = (root: string, file: string) =>
path.join(root, `.vitepress`, file)
path.resolve(root, `.vitepress`, file)

export async function resolveConfig(
root: string = process.cwd()