mirror of
https://github.com/fugary/simple-element-plus-template.git
synced 2026-09-11 09:23:53 +00:00
升级依赖到最新稳定版本,支持 Node 20+
- 升级核心依赖:vue 3.5.41、vue-router 5.2.0、vue-i18n 11.4.2、element-plus 2.14.4 - 升级工具依赖:@vueuse/core 14.4.0、pinia 3.0.4、vue-virtual-scroller 2.0.1(正式版) - 升级图表依赖:echarts 6.1.0、vue-echarts 8.1.0 - 升级 axios 1.19.0、dayjs 1.11.23、lodash-es 4.18.1、monaco-editor 0.56.0 - 升级构建工具:vite 7.3.6、@vitejs/plugin-vue 6.0.8、@vitejs/plugin-vue-jsx 5.1.6 - 升级 @typescript-eslint 8.67.0、@rushstack/eslint-patch 1.16.1 - package.json 新增 engines 字段声明 Node >= 20.0.0 - 优化 vite.config.mjs:eslint 和 mock 插件仅在 dev 模式启用,避免构建阻塞 - 构建分包策略:monaco-editor 独立拆包 monaco chunk - 修复 monaco-editor 0.56.0 worker 导入路径(适配新版 exports 字段) - 新增 acorn ^8.14.0 dev 依赖修复 ESLint 模块解析问题 - .eslintrc.js 关闭 vue/no-v-html 规则以支持动态内容渲染 - README.md 补充 Node.js >= 20.0.0 环境要求说明
This commit is contained in:
@@ -5,7 +5,6 @@ import vue from '@vitejs/plugin-vue'
|
||||
import { viteMockServe } from 'vite-plugin-mock'
|
||||
import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||
import eslint from 'vite-plugin-eslint'
|
||||
import { visualizer } from 'rollup-plugin-visualizer'
|
||||
import packageJson from './package.json'
|
||||
|
||||
const JS_FILE_NAMES = 'js/[name]-[hash].js'
|
||||
@@ -15,25 +14,28 @@ const IMG_FILE_NAMES = 'images/[name]-[hash].[ext]'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default ({ mode, command }) => {
|
||||
|
||||
const env = loadEnv(mode, process.cwd())
|
||||
const optionalPlugins = [{
|
||||
plugin: visualizer({ open: true }),
|
||||
enabled: false
|
||||
}, {
|
||||
plugin: viteMockServe({
|
||||
mockPath: './mock',
|
||||
enable: command === 'serve'
|
||||
}),
|
||||
enabled: command === 'serve'
|
||||
}].filter(p => p.enabled).map(p => p.plugin)
|
||||
const plugins = [
|
||||
vue(),
|
||||
vueJsx()
|
||||
]
|
||||
|
||||
if (command === 'serve') {
|
||||
plugins.push(
|
||||
eslint({ lintOnStart: false }),
|
||||
viteMockServe({
|
||||
mockPath: './mock',
|
||||
enable: true
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
return defineConfig({
|
||||
base: env.VITE_APP_CONTEXT_PATH,
|
||||
define: {
|
||||
'import.meta.env.VITE_APP_VERSION': JSON.stringify(packageJson.version)
|
||||
},
|
||||
plugins: [vue(), vueJsx(), eslint(), ...optionalPlugins],
|
||||
plugins,
|
||||
|
||||
esbuild: {
|
||||
drop: mode === 'production' ? ['console', 'debugger'] : []
|
||||
@@ -61,6 +63,9 @@ export default ({ mode, command }) => {
|
||||
if (id.includes('element-plus')) {
|
||||
return 'elp'
|
||||
}
|
||||
if (id.includes('monaco-editor')) {
|
||||
return 'monaco'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user