代码拉取完成,页面将自动刷新
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { resolve } from 'path';
import Compression from 'vite-plugin-compression';
import Components from 'unplugin-vue-components/vite';
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
import { EleAdminResolver } from 'ele-admin-plus/es/utils/resolvers';
// monaco-editor 汉化
import I18n from './public/I18n/i18n.json';
import nlsPlugin, {
Languages,
esbuildPluginMonacoEditorNls
} from './public/I18n/vite-plugin-i18n-nls';
export default defineConfig(({ command }) => {
const isBuild = command === 'build';
const alias = {
'@/': resolve('src') + '/'
};
const plugins = [vue()];
if (isBuild) {
// 组件按需引入
plugins.push(
Components({
dts: false,
resolvers: [
ElementPlusResolver({
importStyle: 'sass'
}),
EleAdminResolver({
importStyle: 'sass'
})
]
})
);
// gzip压缩
plugins.push(
Compression({
disable: !isBuild,
threshold: 10240,
algorithm: 'gzip',
ext: '.gz'
})
);
// monaco-editor 生产环境汉化
plugins.push(
nlsPlugin({
locale: Languages.zh_hans,
localeData: I18n
})
);
} else {
// 开发环境全局安装
alias['./as-needed'] = './global-import';
}
return {
resolve: { alias },
plugins,
css: {
preprocessorOptions: {
scss: {
additionalData: `@use "@/styles/variables.scss" as *;`
}
}
},
optimizeDeps: {
include: [
'echarts/core',
'echarts/charts',
'echarts/renderers',
'echarts/components',
'vue-echarts',
'echarts-wordcloud',
'sortablejs',
'vuedraggable'
],
// monaco-editor 汉化
esbuildOptions: {
plugins: [
esbuildPluginMonacoEditorNls({
locale: Languages.zh_hans,
localeData: I18n
})
]
}
},
build: {
target: 'chrome63',
chunkSizeWarningLimit: 2000
}
};
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。