-
Notifications
You must be signed in to change notification settings - Fork 3.3k
/
Copy pathoptimize.ts
64 lines (62 loc) · 2.08 KB
/
optimize.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
/**
* 此文件作用于 `vite.config.ts` 的 `optimizeDeps.include` 依赖预构建配置项
* 依赖预构建,`vite` 启动时会将下面 include 里的模块,编译成 esm 格式并缓存到 node_modules/.vite 文件夹,页面加载到对应模块时如果浏览器有缓存就读取浏览器缓存,如果没有会读取本地缓存并按需加载
* 尤其当您禁用浏览器缓存时(这种情况只应该发生在调试阶段)必须将对应模块加入到 include里,否则会遇到开发环境切换页面卡顿的问题(vite 会认为它是一个新的依赖包会重新加载并强制刷新页面),因为它既无法使用浏览器缓存,又没有在本地 node_modules/.vite 里缓存
* 温馨提示:如果您使用的第三方库是全局引入,也就是引入到 src/main.ts 文件里,就不需要再添加到 include 里了,因为 vite 会自动将它们缓存到 node_modules/.vite
*/
const include = [
"qs",
"mitt",
"xlsx",
"dayjs",
"axios",
"pinia",
"vditor",
"typeit",
"swiper",
"qrcode",
"intro.js",
"vue-i18n",
"deep-chat",
"vxe-table",
"vue-types",
"js-cookie",
"vue-tippy",
"cropperjs",
"jsbarcode",
"codemirror",
"pinyin-pro",
"sortablejs",
"swiper/vue",
"mint-filter",
"highlight.js",
"@vueuse/core",
"vue3-danmaku",
"v-contextmenu",
"vue-pdf-embed",
"wavesurfer.js",
"swiper/modules",
"china-area-data",
"vue-json-pretty",
"@logicflow/core",
"@pureadmin/utils",
"@wangeditor/editor",
"responsive-storage",
"plus-pro-components",
"@howdyjs/mouse-menu",
"@logicflow/extension",
"vue-virtual-scroller",
"codemirror-editor-vue3",
"@amap/amap-jsapi-loader",
"el-table-infinite-scroll",
"vue-waterfall-plugin-next",
"@infectoone/vue-ganttastic",
"@wangeditor/editor-for-vue",
"vuedraggable/src/vuedraggable"
];
/**
* 在预构建中强制排除的依赖项
* 温馨提示:平台推荐的使用方式是哪里需要哪里引入而且都是单个的引入,不需要预构建,直接让浏览器加载就好
*/
const exclude = ["@iconify/json"];
export { include, exclude };