| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import vue from '@vitejs/plugin-vue'
- import path from 'path'
- import { ConfigEnv, defineConfig, UserConfigExport } from 'vite'
- import { viteVConsole } from 'vite-plugin-vconsole'
- export default ({ command, mode }: ConfigEnv): UserConfigExport => defineConfig({
- base: '/',
- css: {
- preprocessorOptions: {
- scss: {
- additionalData: '@import "./src/styles/variables";'
- },
- }
- },
- resolve: {
- alias: [
- {
- find: '/@',
- replacement: path.resolve(__dirname, './src'),
- }
- ]
- },
- server: {
- open: true,
- host: '0.0.0.0',
- port: 8080
- },
- build: {
- target: ['es2015'], // 最低支持 es2015
- sourcemap: true
- },
- plugins: [
- vue(),
- viteVConsole({
- entry: path.resolve(__dirname, './src/main.ts'), // 入口文件
- localEnabled: command === 'serve', // serve开发环境下
- // enabled: command !== 'serve' || mode === 'test', // 打包环境下/发布测试包,
- config: { // vconsole 配置项
- maxLogNumber: 1000,
- theme: 'light'
- }
- }),
- ],
- })
|