fix: improve fs allow

pull/389/head
Evan You 3 years ago
parent c1ba483e58
commit 2e9264f032

@ -2,12 +2,10 @@ import path from 'path'
import { Alias, AliasOptions } from 'vite' import { Alias, AliasOptions } from 'vite'
const PKG_ROOT = path.join(__dirname, '../../') const PKG_ROOT = path.join(__dirname, '../../')
export const APP_PATH = path.join(__dirname, '../client/app') export const DIST_CLIENT_PATH = path.join(__dirname, '../client')
export const SHARED_PATH = path.join(__dirname, '../client/shared') export const APP_PATH = path.join(DIST_CLIENT_PATH, 'app')
export const DEFAULT_THEME_PATH = path.join( export const SHARED_PATH = path.join(DIST_CLIENT_PATH, 'shared')
__dirname, export const DEFAULT_THEME_PATH = path.join(DIST_CLIENT_PATH, 'theme-default')
'../client/theme-default'
)
// special virtual file // special virtual file
// we can't directly import '/@siteData' because // we can't directly import '/@siteData' because

@ -5,7 +5,7 @@ import {
createMarkdownToVueRenderFn, createMarkdownToVueRenderFn,
MarkdownCompileResult MarkdownCompileResult
} from './markdownToVue' } from './markdownToVue'
import { APP_PATH, SITE_DATA_REQUEST_PATH } from './alias' import { DIST_CLIENT_PATH, APP_PATH, SITE_DATA_REQUEST_PATH } from './alias'
import createVuePlugin from '@vitejs/plugin-vue' import createVuePlugin from '@vitejs/plugin-vue'
import { slash } from './utils/slash' import { slash } from './utils/slash'
import { OutputAsset, OutputChunk } from 'rollup' import { OutputAsset, OutputChunk } from 'rollup'
@ -87,7 +87,7 @@ export function createVitePressPlugin(
}, },
server: { server: {
fs: { fs: {
allow: [APP_PATH, srcDir] allow: [DIST_CLIENT_PATH, srcDir, process.cwd()]
} }
} }
}) })

Loading…
Cancel
Save