Skip to content

Commit 2e9264f

Browse files
committed
fix: improve fs allow
1 parent c1ba483 commit 2e9264f

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/node/alias.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ import path from 'path'
22
import { Alias, AliasOptions } from 'vite'
33

44
const PKG_ROOT = path.join(__dirname, '../../')
5-
export const APP_PATH = path.join(__dirname, '../client/app')
6-
export const SHARED_PATH = path.join(__dirname, '../client/shared')
7-
export const DEFAULT_THEME_PATH = path.join(
8-
__dirname,
9-
'../client/theme-default'
10-
)
5+
export const DIST_CLIENT_PATH = path.join(__dirname, '../client')
6+
export const APP_PATH = path.join(DIST_CLIENT_PATH, 'app')
7+
export const SHARED_PATH = path.join(DIST_CLIENT_PATH, 'shared')
8+
export const DEFAULT_THEME_PATH = path.join(DIST_CLIENT_PATH, 'theme-default')
119

1210
// special virtual file
1311
// we can't directly import '/@siteData' because

src/node/plugin.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
createMarkdownToVueRenderFn,
66
MarkdownCompileResult
77
} from './markdownToVue'
8-
import { APP_PATH, SITE_DATA_REQUEST_PATH } from './alias'
8+
import { DIST_CLIENT_PATH, APP_PATH, SITE_DATA_REQUEST_PATH } from './alias'
99
import createVuePlugin from '@vitejs/plugin-vue'
1010
import { slash } from './utils/slash'
1111
import { OutputAsset, OutputChunk } from 'rollup'
@@ -87,7 +87,7 @@ export function createVitePressPlugin(
8787
},
8888
server: {
8989
fs: {
90-
allow: [APP_PATH, srcDir]
90+
allow: [DIST_CLIENT_PATH, srcDir, process.cwd()]
9191
}
9292
}
9393
})

0 commit comments

Comments
 (0)