2024-03-04 07:10:11 +00:00
|
|
|
|
import { defineConfig } from "vite";
|
|
|
|
|
import uni from "@dcloudio/vite-plugin-uni";
|
|
|
|
|
import AutoImport from "unplugin-auto-import/vite";
|
|
|
|
|
import path from "path"; // 引入pnpm install @types/node --save-dev
|
|
|
|
|
import ENV_CONFIG from "./src/config/env";
|
|
|
|
|
// https://vitejs.dev/config/
|
2024-05-09 05:38:36 +00:00
|
|
|
|
// process.env.NODE_ENV === "development"
|
2024-03-04 07:10:11 +00:00
|
|
|
|
export default defineConfig({
|
|
|
|
|
build: {
|
2024-05-09 05:38:36 +00:00
|
|
|
|
sourcemap: false,
|
2024-03-04 07:10:11 +00:00
|
|
|
|
},
|
|
|
|
|
define: {
|
|
|
|
|
"process.env.config": ENV_CONFIG,
|
|
|
|
|
'process.env': process.env, //配置二
|
|
|
|
|
},
|
|
|
|
|
plugins: [
|
|
|
|
|
uni(),
|
|
|
|
|
AutoImport({
|
|
|
|
|
// 目标文件
|
|
|
|
|
include: [
|
|
|
|
|
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
|
|
|
|
|
/\.vue$/,
|
|
|
|
|
/\.vue\?vue/, // .vue
|
|
|
|
|
/\.md$/, // .md
|
|
|
|
|
],
|
|
|
|
|
// 使用
|
|
|
|
|
imports: ["vue"],
|
|
|
|
|
dts: "src/auto-import.d.ts",
|
|
|
|
|
// 如有用到eslint记得加上写段,没有用到可以忽略
|
|
|
|
|
eslintrc: {
|
|
|
|
|
enabled: false,
|
|
|
|
|
filepath: "./.eslintrc-auto-import.json", // Default `./.eslintrc-auto-import.json`
|
|
|
|
|
globalsPropValue: true, // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
"@": path.resolve(__dirname, "./src"),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|