1 Star 0 Fork 1

李慧根/语州科技门户网站

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vite.config.js 1.83 KB
一键复制 编辑 原始数据 按行查看 历史
浪漫大海 提交于 2022-10-10 17:44 . 提交代码
import { resolve } from 'path'
import { defineConfig } from 'vite'
import viteCompression from 'vite-plugin-compression'
import visualizer from 'rollup-plugin-visualizer'
import vue from '@vitejs/plugin-vue'
import legacy from '@vitejs/plugin-legacy'
import Components from 'unplugin-vue-components/vite'
import {
ArcoResolver,
NaiveUiResolver,
ElementPlusResolver,
VueUseComponentsResolver
} from 'unplugin-vue-components/resolvers'
// https://vitejs.dev/config/
export default defineConfig(({ command }) => {
const assetsDir = 'static'
const config = {
resolve: {
alias: [
{
find: /\/@\//,
replacement: resolve(__dirname, './src') + '/'
}
]
},
build: {
assetsDir,
rollupOptions: {
output: {
entryFileNames: `${assetsDir}/[hash].js`,
chunkFileNames: `${assetsDir}/[hash].js`,
assetFileNames: `${assetsDir}/[hash].[ext]`
}
}
},
server: {
host: '0.0.0.0'
}
}
const plugins = [
vue(),
Components({
deep: true,
resolvers: [
ArcoResolver({
resolveIcons: true
}),
NaiveUiResolver(),
ElementPlusResolver(),
VueUseComponentsResolver()
]
}),
legacy({
targets: ['ie >= 11'],
additionalLegacyPolyfills: [
'unfetch/polyfill/polyfill.mjs', // fetch
'matchmedia-polyfill/matchMedia.addListener', // vue-mq
'regenerator-runtime/runtime' // ie11
]
})
]
if (command === 'build') {
if (process.env.npm_config_report) {
// npm run build --report
// npm_config_report=true yarn build
plugins.push(visualizer({
open: true
}))
}
plugins.push(viteCompression({
algorithm: 'brotliCompress'
}))
}
return {
...config,
plugins
}
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zoomLee/language-state-portal.git
git@gitee.com:zoomLee/language-state-portal.git
zoomLee
language-state-portal
语州科技门户网站
master

搜索帮助