File tree 3 files changed +11
-3
lines changed
3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ import 'vite/modulepreload-polyfill'
34
34
35
35
每个动态导入要预加载的块列表将由 Vite 计算。默认情况下,在载入这些依赖时,会使用一个包含 ` base ` 的绝对路径。如果 ` base ` 是相对路径(` '' ` 或者 './'),解析时则会使用 ` import.meta.url ` ,以避免出现依赖于最终部署基路径的绝对路径。
36
36
37
- 目前有一个实验性功能支持使用 ` resolveDependencies ` 函数对依赖项列表及其路径进行细粒度控制。它期望接收一个 ` resolvemodulepreloaddependciesfn ` 类型的函数:
37
+ 目前有一个实验性功能支持使用 ` resolveDependencies ` 函数对依赖项列表及其路径进行细粒度控制。它期望接收一个 ` ResolveModulePreloadDependenciesFn ` 类型的函数:
38
38
39
39
``` ts
40
40
type ResolveModulePreloadDependenciesFn = (
Original file line number Diff line number Diff line change @@ -117,6 +117,11 @@ interface ViteDevServer {
117
117
* 解决 ssr 错误堆栈信息
118
118
*/
119
119
ssrFixStacktrace(e: Error): void
120
+ /**
121
+ * 触发模块图中某个模块的 HMR。你可以使用 ` server .moduleGraph `
122
+ * API 来检索要重新加载的模块。如果 ` hmr ` 是 ` false ` ,则不进行任何操作
123
+ */
124
+ reloadModule(module: ModuleNode): Promise<void>
120
125
/**
121
126
* 启动服务器
122
127
*/
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ export type { T }
57
57
58
58
#### ` useDefineForClassFields `
59
59
60
- 从 Vite v2.5.0 开始,如果 TypeScript 的 target 是 ` ESNext ` ,此选项默认值则为 ` true ` 。这与 [ ` tsc ` v4.3.2 及以后版本的行为] ( https://github.com/microsoft/TypeScript/pull/42663 ) 一致。这也是标准的 ECMAScript 的运行时行为。
60
+ 从 Vite v2.5.0 开始,如果 TypeScript 的 target 是 ` ES2022 ` 或更高,包括 ` ESNext ` ,则此选项默认值为 ` true ` 。这与 [ ` tsc ` v4.3.2 及以后版本的行为] ( https://github.com/microsoft/TypeScript/pull/42663 ) 一致。这也是标准的 ECMAScript 的运行时行为。
61
61
62
62
但对于那些习惯其他编程语言或旧版本 TypeScript 的开发者来说,这可能是违反直觉的。
63
63
你可以参阅 [ TypeScript 3.7 发布日志] ( https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier ) 中了解更多关于如何兼容的信息。
@@ -71,10 +71,13 @@ export type { T }
71
71
#### 影响构建结果的其他编译器选项 {#other-compiler-options-affecting-the-build-result}
72
72
73
73
- [ ` extends ` ] ( https://www.typescriptlang.org/tsconfig#extends )
74
+ - [ ` alwaysStrict ` ] ( https://www.typescriptlang.org/tsconfig#alwaysStrict )
74
75
- [ ` importsNotUsedAsValues ` ] ( https://www.typescriptlang.org/tsconfig#importsNotUsedAsValues )
75
- - [ ` preserveValueImports ` ] ( https://www.typescriptlang.org/tsconfig#preserveValueImports )
76
+ - [ ` jsx ` ] ( https://www.typescriptlang.org/tsconfig#jsx )
76
77
- [ ` jsxFactory ` ] ( https://www.typescriptlang.org/tsconfig#jsxFactory )
77
78
- [ ` jsxFragmentFactory ` ] ( https://www.typescriptlang.org/tsconfig#jsxFragmentFactory )
79
+ - [ ` jsxImportSource ` ] ( https://www.typescriptlang.org/tsconfig#jsxImportSource )
80
+ - [ ` preserveValueImports ` ] ( https://www.typescriptlang.org/tsconfig#preserveValueImports )
78
81
79
82
如果你的代码库很难迁移到 ` "isolatedModules": true ` ,或许你可以尝试通过第三方插件来解决,比如 [ rollup-plugin-friendly-type-imports] ( https://www.npmjs.com/package/rollup-plugin-friendly-type-imports ) 。但是,这种方式不被 Vite 官方支持。
80
83
You can’t perform that action at this time.
0 commit comments