42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
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/
|
||
export default defineConfig({
|
||
build: {
|
||
sourcemap: process.env.NODE_ENV === "development",
|
||
},
|
||
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"),
|
||
},
|
||
},
|
||
});
|