|
|
import {defineConfig} from 'vite'
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
import Components from 'unplugin-vue-components/vite'
|
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
|
import {ElementPlusResolver} from 'unplugin-vue-components/resolvers'
|
|
|
import OptimizationPersist from 'vite-plugin-optimize-persist'
|
|
|
import PkgConfig from 'vite-plugin-package-config'
|
|
|
|
|
|
import {createHtmlPlugin} from 'vite-plugin-html';
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
|
|
export default defineConfig({
|
|
|
publicPath: '/OperationsManagement',
|
|
|
build: {
|
|
|
outDir: 'OperationsManagement', // 指定输出路径
|
|
|
},
|
|
|
plugins: [
|
|
|
vue(),
|
|
|
AutoImport({
|
|
|
resolvers: [ElementPlusResolver()],
|
|
|
}), Components({
|
|
|
resolvers: [ElementPlusResolver()],
|
|
|
}),
|
|
|
PkgConfig(),
|
|
|
OptimizationPersist(),
|
|
|
createHtmlPlugin({
|
|
|
inject: {
|
|
|
data: {
|
|
|
injectMapScript: `<script src="./resource/bmapOffline/map_load.js"></script>`,
|
|
|
},
|
|
|
},
|
|
|
minify: true,
|
|
|
}),
|
|
|
],
|
|
|
base: "./",//打包路径
|
|
|
mode: 'hash',
|
|
|
server: {
|
|
|
// open: true,//启动项目自动弹出浏览器
|
|
|
port: 9988,//启动端口
|
|
|
host: "0.0.0.0",
|
|
|
disableHostCheck: true,
|
|
|
cors: true, // 默认启用并允许任何源
|
|
|
// proxy: {
|
|
|
// '/': {
|
|
|
// target: 'http://localhost:9440/',
|
|
|
// changeOrigin: true,
|
|
|
// ws: true,
|
|
|
// rewrite: (path) => path.replace('9988', '9440')
|
|
|
// }
|
|
|
// }
|
|
|
},
|
|
|
css: {
|
|
|
postcss: {
|
|
|
plugins: [
|
|
|
require("postcss-pxtorem")({
|
|
|
rootValue: 190,
|
|
|
propList: ['*', '!border'], // 除 border 外所有px 转 rem
|
|
|
selectorBlackList: ['.loading','.dot','el-'] // 过滤掉.am-开头的class,不进行rem转换
|
|
|
})
|
|
|
]
|
|
|
},
|
|
|
},
|
|
|
})
|
|
|
|