| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- // import {vitePluginSvg} from "@webxrd/vite-plugin-svg"
- import { resolve } from 'path'
- // import commonjs from 'vite-plugin-commonjs';
- // import commonjs from '@rollup/plugin-commonjs';
- // https://vitejs.dev/config/
- const pathResolve = (dir) => {
- return resolve(__dirname, ".", dir)
- }
- const alias = {
- '@': pathResolve("src"),
- }
- /**
- * @description-en vite document address
- * @description-cn vite官网
- * https://vitejs.cn/config/ */
- export default ({ command }) => {
- const prodMock = true;
- return {
- base: './',
- resolve: {
- alias
- },
- server: {
- port: 3001,
- host: '0.0.0.0',
- open: true,
- proxy: { // 代理配置
- '/pro-api':{
- target: 'http://47.121.202.117:81',
- changeOrigin: true,
- rewrite: (path) => {
- return path.replace('/pro-api', '/')
- }
- }
- },
- },
- // build: {
- // rollupOptions: {
- // output: {
- // manualChunks: {
- // 'echarts': ['echarts']
- // }
- // }
- // }
- // },
- plugins: [
- // commonjs(),
- vue(),
- // viteMockServe({
- // mockPath: 'mock',
- // localEnabled: command === 'serve',
- // prodEnabled: command !== 'serve' && prodMock,
- // watchFiles: true,
- // injectCode: `
- // import { setupProdMockServer } from '../mockProdServer';
- // setupProdMockServer();
- // `,
- // logger: true,
- // }),
- // vitePluginSvg({
- // // 必要的。必须是绝对路径组成的数组。
- // iconDirs: [
- // resolve(__dirname, 'src/assets/svg'),
- // ],
- // // 必要的。入口script
- // main: resolve(__dirname, 'src/main.js'),
- // symbolIdFormat: 'icon-[name]'
- // }),
- ],
- css: {
- postcss: {
- plugins: [
- {
- postcssPlugin: 'internal:charset-removal',
- AtRule: {
- charset: (atRule) => {
- if (atRule.name === 'charset') {
- atRule.remove();
- }
- }
- }
- }
- ],
- },
- preprocessorOptions: {
- scss: {
- api: 'modern-compiler', // 修改api调用方式
- },
- },
- }
- };
- }
|