forked from ljxi/NetworkPanel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
70 lines (69 loc) · 1.75 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { visualizer } from "rollup-plugin-visualizer";
import importToCDN from 'vite-plugin-cdn-import'
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
import legacyPlugin from '@vitejs/plugin-legacy'
export default defineConfig({
plugins: [
vue(),
importToCDN({
prodUrl: 'https://cdn.staticfile.org/{name}/{version}/{path}',
// prodUrl: 'https://cdn.bootcdn.net/ajax/libs/{name}/{version}/{path}',
modules: [
{
name: "echarts",
var: "echarts",
path: "echarts.min.js",
},
{
name: 'vue',
var: 'Vue',
path: `vue.runtime.global.prod.min.js`,
},
{
name: 'element-plus',
var: 'ElementPlus',
path: `index.full.min.js`,
css: 'index.min.css'
},
],
}),
cssInjectedByJsPlugin(),
legacyPlugin({
targets:['chrome 52'], // 需要兼容的目标列表,可以设置多个
additionalLegacyPolyfills:['regenerator-runtime/runtime'] // 面向IE11时需要此插件
}),
visualizer({
gzipSize: true,
brotliSize: true,
emitFile: false,
filename: "visualizer.html",
template :"sunburst",
open:false
})
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
build:{
assetsDir: 'assets',
assetsInlineLimit: 8 * 1024,
// rollupOptions:{
// manualChunks(id){
// if(id.includes('node_modules')){
// return "vendor"
// }
// }
// }
},
server: {
open: true,
port: 3005,
host: '0.0.0.0'
},
base: './'
})