first commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
// 环境变量处理方法
|
||||
export function wrapperEnv(envConf: Recordable): ViteEnv {
|
||||
const ret: Record<string, string | number | boolean> = {};
|
||||
|
||||
for (const envName of Object.keys(envConf)) {
|
||||
let realName = envConf[envName].replace(/\\n/g, "\n");
|
||||
realName = realName === "true" ? true : realName === "false" ? false : realName;
|
||||
if (envName === "VITE_PORT") realName = Number(realName);
|
||||
ret[envName] = realName;
|
||||
if (typeof realName === "string") {
|
||||
process.env[envName] = realName;
|
||||
} else if (typeof realName === "object") {
|
||||
process.env[envName] = JSON.stringify(realName);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
/**
|
||||
* * 扩展setup插件,支持在script标签中使用name属性
|
||||
* usage: <script setup name="MyComp"></script>
|
||||
*/
|
||||
import VueSetupExtend from 'vite-plugin-vue-setup-extend'
|
||||
|
||||
export function createVitePlugins(viteEnv: Record<string, string>, isBuild: boolean): any[] {
|
||||
const plugins = [
|
||||
vue(),
|
||||
VueSetupExtend(),
|
||||
]
|
||||
|
||||
return plugins
|
||||
}
|
||||
Reference in New Issue
Block a user