feat(config): 添加 VITE_CLOUDFLARE_SERVER_ENABLED 环境变量支持
This commit is contained in:
@@ -4,10 +4,14 @@ import MetaLayouts from 'vite-plugin-vue-meta-layouts';
|
||||
export default [
|
||||
// https://github.com/dishait/vite-plugin-vue-meta-layouts
|
||||
MetaLayouts({
|
||||
target: 'src/layouts',
|
||||
excludes: ['**/!(the-)*.vue'], // 排除非 the- 开头的文件。
|
||||
metaName: 'layout',
|
||||
// defaultLayout: 'sakai-vue/AppLayout',
|
||||
// defaultLayout: 'naive-ui/AppLayout',
|
||||
defaultLayout: 'base-layout/the-base-layout',
|
||||
// !⬇️: 当设置为 `sync` 时,注意`import 'virtual:uno.css'`的顺序问题。
|
||||
// importMode: 'sync', // 默认为自动处理,SSG 时为 sync,非 SSG 时为 async
|
||||
defaultLayout: 'base-layout/base-layout',
|
||||
skipTopLevelRouteLayout: true, // 打开修复 https://github.com/JohnCampionJr/vite-plugin-vue-layouts/issues/134,默认为 false 关闭
|
||||
}),
|
||||
] satisfies PluginOption;
|
||||
|
||||
@@ -6,11 +6,12 @@ export function loadPlugin(configEnv: ConfigEnv): PluginOption {
|
||||
const env = loadEnv(configEnv.mode, process.cwd());
|
||||
|
||||
if (configEnv.command === 'build') {
|
||||
consola.info('VITE_ENABLE_VUE_DEVTOOLS is not enabled in build mode.');
|
||||
consola.info('vue-devtools plugin is not used in build mode.');
|
||||
return [];
|
||||
}
|
||||
|
||||
if (env.VITE_ENABLE_VUE_DEVTOOLS === 'true') {
|
||||
if (env.VITE_ENABLE_VUE_DEVTOOLS !== 'true') {
|
||||
consola.info('vue-devtools plugin disabled by env');
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
@@ -7,5 +7,9 @@ export function loadPlugin(_configEnv: ConfigEnv): PluginOption {
|
||||
console.log('cloudflare plugin disabled in test mode');
|
||||
return [];
|
||||
}
|
||||
if (process.env.VITE_CLOUDFLARE_SERVER_ENABLED !== 'true') {
|
||||
console.log('cloudflare plugin disabled by env');
|
||||
return [];
|
||||
}
|
||||
return [cloudflare()];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user