2023-12-01 18:22:09 +08:00
|
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
|
import path from 'path'
|
|
|
|
|
import postCssPxToRem from 'postcss-pxtorem'
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
plugins: [vue()],
|
|
|
|
|
server: { // ← ← ← ← ← ←
|
2024-01-06 15:51:01 +08:00
|
|
|
|
host: '0.0.0.0', // ← 新增内容 ←
|
2024-02-02 18:21:43 +08:00
|
|
|
|
port:"8886"
|
2023-12-01 18:22:09 +08:00
|
|
|
|
},
|
|
|
|
|
resolve: {
|
|
|
|
|
//别名配置,引用src路径下的东西可以通过@如:import Layout from '@/layout/index.vue'
|
|
|
|
|
alias: {
|
|
|
|
|
'@': path.resolve(__dirname, 'src')
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
css: {
|
|
|
|
|
postcss: {
|
|
|
|
|
plugins: [
|
|
|
|
|
postCssPxToRem({
|
|
|
|
|
rootValue: 192,
|
|
|
|
|
propList: ['*'],
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
optimizeDeps: {
|
|
|
|
|
// 开发时 解决这些commonjs包转成esm包
|
|
|
|
|
include: [
|
|
|
|
|
"@jiaminghi/c-render",
|
|
|
|
|
"@jiaminghi/c-render/lib/plugin/util",
|
|
|
|
|
"@jiaminghi/charts/lib/util/index",
|
|
|
|
|
"@jiaminghi/charts/lib/util",
|
|
|
|
|
"@jiaminghi/charts/lib/extend/index",
|
|
|
|
|
"@jiaminghi/charts",
|
|
|
|
|
"@jiaminghi/color",
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
build: {
|
|
|
|
|
// 打包时需要另外处理的commonjs规范的包
|
|
|
|
|
commonjsOptions: {
|
|
|
|
|
include: [
|
|
|
|
|
/node_modules/, // 必须包含
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|