Skip to content

Commit

Permalink
fix: global install allow serve root, close #295
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 17, 2021
1 parent 1b3c3f5 commit 465e4fb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/slidev/node/plugins/extendConfig.ts
@@ -1,6 +1,7 @@
import { join } from 'path'
import { dirname, join } from 'path'
import { InlineConfig, mergeConfig, Plugin } from 'vite'
import isInstalledGlobally from 'is-installed-globally'
import resolveGlobal from 'resolve-global'
import { getIndexHtml } from '../common'
import { dependencies } from '../../../client/package.json'
import { ResolvedSlidevOptions } from '../options'
Expand Down Expand Up @@ -47,6 +48,15 @@ export function createConfigPlugin(options: ResolvedSlidevOptions): Plugin {
server: {
fs: {
strict: true,
allow: [
dirname(options.userRoot),
options.cliRoot,
...(
isInstalledGlobally
? [dirname(resolveGlobal('@slidev/client/package.json'))]
: []
),
],
},
},
}
Expand Down
14 changes: 14 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 465e4fb

Please sign in to comment.