File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -227,9 +227,8 @@ declare const __APP_VERSION__: string
227227指定传递给 CSS 预处理器的选项。文件扩展名用作选项的键。每个预处理器支持的选项可以在它们各自的文档中找到:
228228
229229- ` sass ` /` scss ` :
230- - 选择要使用的 sass 应用程序接口 ` api: "modern-compiler" | "modern" | "legacy" ` (如果安装了` sass-embedded ` ,默认为` "modern-compiler" ` ,否则为 ` "modern" ` ). 为获得最佳性能,建议使用 ` api: "modern-compiler" ` 和 ` sass-embedded ` 软件包。` "legacy" ` API 已过时,将在 Vite 7 中移除。
231- - [ Options (modern)] ( https://sass-lang.com/documentation/js-api/interfaces/stringoptions/ )
232- - [ Options (legacy)] ( https://sass-lang.com/documentation/js-api/interfaces/LegacyStringOptions ) .
230+ - 选择要使用的 sass 应用程序接口 ` api: "modern-compiler" | "modern" ` (如果安装了` sass-embedded ` ,默认为` "modern-compiler" ` ,否则为 ` "modern" ` ). 为获得最佳性能,建议使用 ` api: "modern-compiler" ` 和 ` sass-embedded ` 软件包。
231+ - [ Options] ( https://sass-lang.com/documentation/js-api/interfaces/stringoptions/ )
233232- ` less ` : [ 选项] ( https://lesscss.org/usage/#less-options ) .
234233- ` styl ` /` stylus ` : 仅支持 [ ` define ` ] ( https://stylus-lang.com/docs/js.html#define-name-node ) ,可以作为对象传递。
235234
@@ -248,7 +247,7 @@ export default defineConfig({
248247 },
249248 },
250249 scss: {
251- api: ' modern-compiler' , // 或 "modern","legacy"
250+ api: ' modern-compiler' , // 或 "modern"
252251 importers: [
253252 // ...
254253 ],
Original file line number Diff line number Diff line change @@ -329,6 +329,8 @@ export default {
329329}
330330` ` `
331331
332+ 插件还可以定义一个 ` buildApp` 钩子。顺序 ` ' pre' ` 和 ` null ' ` 在配置的 `builder.buildApp` 之前执行,顺序 `' post' ` 钩子在其之后执行。`environment.isBuilt` 可用于检查环境是否已被构建。
333+
332334## 环境无关的代码 {#environment-agnostic-code}
333335
334336大部分情况,当前的 `environment` 实例会作为正在运行代码的上下文中的一部分,所以通过 `server.environments` 来访问它们的需求应该很少。例如,在插件钩子内部,环境是作为 `PluginContext` 的一部分暴露出来的,所以可以使用 `this.environment` 来访问它。参见 [用于插件的环境 API](./api-environment-plugins.md) 了解如何构建对环境敏感的插件。
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ Vite 还提供了强大的扩展性,可通过其 [插件 API](./api-plugin)
4444## 搭建第一个 Vite 项目 {#scaffolding-your-first-vite-project}
4545
4646::: tip 兼容性注意
47- Vite 需要 [ Node.js] ( https://nodejs.org/en/ ) 版本 18+ 或 20+。然而,有些模板需要依赖更高的 Node 版本才能正常运行,当你的包管理器发出警告时,请注意升级你的 Node 版本。
47+ Vite 需要 [ Node.js] ( https://nodejs.org/en/ ) 版本 20+。然而,有些模板需要依赖更高的 Node 版本才能正常运行,当你的包管理器发出警告时,请注意升级你的 Node 版本。
4848:::
4949
5050::: code-group
You can’t perform that action at this time.
0 commit comments