2024-06-19 11:01:39 +08:00
|
|
|
|
import { defineConfig, loadEnv } from 'vite'
|
2023-11-22 15:12:56 +08:00
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
2023-11-22 18:30:06 +08:00
|
|
|
|
import path from 'path'
|
2023-12-07 19:05:27 +08:00
|
|
|
|
import postCssPxToRem from 'postcss-pxtorem'
|
2023-11-22 15:12:56 +08:00
|
|
|
|
export default defineConfig({
|
2024-06-19 11:01:39 +08:00
|
|
|
|
plugins: [vue()],
|
2024-06-26 09:26:24 +08:00
|
|
|
|
base: 'yusi/',
|
2024-06-24 14:42:36 +08:00
|
|
|
|
// base: 'sss/',
|
2024-06-19 11:01:39 +08:00
|
|
|
|
server: { // ← ← ← ← ← ←
|
|
|
|
|
host: '0.0.0.0' // ← 新增内容 ←
|
|
|
|
|
},
|
|
|
|
|
resolve: {
|
|
|
|
|
//别名配置,引用src路径下的东西可以通过@如:import Layout from '@/layout/index.vue'
|
|
|
|
|
alias: {
|
|
|
|
|
'@': path.resolve(__dirname, 'src')
|
|
|
|
|
},
|
2023-12-07 19:05:27 +08:00
|
|
|
|
},
|
|
|
|
|
|
2024-06-19 11:01:39 +08:00
|
|
|
|
css: {
|
|
|
|
|
postcss: {
|
|
|
|
|
plugins: [
|
|
|
|
|
postCssPxToRem({
|
|
|
|
|
rootValue: 192,
|
|
|
|
|
propList: ['*'],
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
},
|
2023-12-07 19:05:27 +08:00
|
|
|
|
|
2024-06-19 11:01:39 +08:00
|
|
|
|
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",
|
|
|
|
|
],
|
2023-11-23 19:39:47 +08:00
|
|
|
|
},
|
2024-06-19 11:01:39 +08:00
|
|
|
|
build: {
|
|
|
|
|
// 打包时需要另外处理的commonjs规范的包
|
|
|
|
|
commonjsOptions: {
|
|
|
|
|
include: [
|
|
|
|
|
/node_modules/, // 必须包含
|
|
|
|
|
],
|
|
|
|
|
},
|
2024-06-24 14:42:36 +08:00
|
|
|
|
// outDir: 'sss',
|
2024-06-26 09:26:24 +08:00
|
|
|
|
outDir: 'yusi',
|
2024-06-19 11:01:39 +08:00
|
|
|
|
}
|
2023-11-22 18:30:06 +08:00
|
|
|
|
|
2023-11-23 19:39:47 +08:00
|
|
|
|
|
2023-11-22 15:12:56 +08:00
|
|
|
|
})
|