File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 10
10
11
11
默认情况下,Vite 会抓取你的 ` index.html ` 来检测需要预构建的依赖项(忽略了` node_modules ` 、` build.outDir ` 、` __tests__ ` 和 ` coverage ` )。如果指定了 ` build.rollupOptions.input ` ,Vite 将转而去抓取这些入口点。
12
12
13
- 如果这两者都不合你意,则可以使用此选项指定自定义条目——该值需要遵循 [ tinyglobby 模式] ( https://github.com/SuperchupuDev/tinyglobby ) ,或者是相对于 Vite 项目根目录的匹配模式数组。当显式声明了 ` optimizeDeps.entries ` 时默认只有 ` node_modules ` 和 ` build.outDir ` 文件夹会被忽略。如果还需忽略其他文件夹,你可以在模式列表中使用以 ` ! ` 为前缀的、用来匹配忽略项的模式。如果你不想忽略 ` node_modules ` 和 ` build.outDir ` ,你可以选择直接使用字符串路径(不使用 tinyglobby 模式) 。
13
+ 如果这两者都不合你意,则可以使用此选项指定自定义条目——该值需要遵循 [ tinyglobby 模式] ( https://github.com/SuperchupuDev/tinyglobby ) ,或者是相对于 Vite 项目根目录的匹配模式数组。当显式声明了 ` optimizeDeps.entries ` 时默认只有 ` node_modules ` 和 ` build.outDir ` 文件夹会被忽略。如果还需忽略其他文件夹,你可以在模式列表中使用以 ` ! ` 为前缀的、用来匹配忽略项的模式。对于明确包含字符串 ` node_modules ` 的模式,不会忽略 ` node_modules ` 。
14
14
15
15
## optimizeDeps.exclude {#optimizedeps-exclude}
16
16
@@ -78,6 +78,13 @@ export default defineConfig({
78
78
79
79
设置为 ` true ` 可以强制依赖预构建,而忽略之前已经缓存过的、已经优化过的依赖。
80
80
81
+ ## optimizeDeps.noDiscovery {#optimizedeps-no-discovery}
82
+
83
+ - ** 类型:** ` boolean `
84
+ - ** 默认:** ` false `
85
+
86
+ 设置为 true 时,自动依赖项发现将被禁用,并且仅优化 ` optimizeDeps.include ` 中列出的依赖项。在开发过程中,仅 CJS 依赖项必须存在于 ` optimizeDeps.include ` 中。
87
+
81
88
## optimizeDeps.holdUntilCrawlEnd
82
89
83
90
- ** 实验性:** [ 提供反馈] ( https://github.com/vitejs/vite/discussions/15834 )
You can’t perform that action at this time.
0 commit comments