File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -461,3 +461,27 @@ interface PreprocessCSSResult {
461461使用するプリプロセッサーは、` filename ` の拡張子から推定されます。` filename ` の最後が ` .module.{ext} ` で終わる場合、[CSS module ](https :// github.com/css-modules/css-modules) として推定され、返される結果には、元のクラス名を変換後のクラス名にマッピングする `modules` オブジェクトが含まれます。
462462
463463プリプロセスは、` url() ` や ` image-set() ` 内の URL を解決しないことに注意してください。
464+
465+ ## ` version `
466+
467+ ** 型:** ` string `
468+
469+ 現在の Vite のバージョンを文字列で返します(例:` "8.0.0" ` )。
470+
471+ ## ` rolldownVersion `
472+
473+ ** 型:** ` string `
474+
475+ Vite が使用する Rolldown のバージョンを文字列で返します(例:` "1.0.0" ` )。` rolldown ` の [` VERSION ` ](https :// rolldown.rs/reference/Variable.VERSION) の再エクスポートです。
476+
477+ ## ` esbuildVersion `
478+
479+ ** 型:** ` string `
480+
481+ 後方互換性のためにのみ保持されています。
482+
483+ ## ` rollupVersion `
484+
485+ ** 型:** ` string `
486+
487+ 後方互換性のためにのみ保持されています。
Original file line number Diff line number Diff line change @@ -477,6 +477,33 @@ Vite プラグインは Vite 特有の目的を果たすフックを提供する
477477 }
478478 ` ` `
479479
480+ ## プラグインコンテキストメタ {#plugin- context- meta}
481+
482+ プラグインコンテキストにアクセスできるプラグインフックでは、Vite は ` this.meta` に追加のプロパティを公開します:
483+
484+ - ` this.meta.viteVersion` : 現在の Vite バージョンの文字列(例:` "8.0.0"` )。
485+
486+ ::: tip Rolldown ベースの Vite の検出
487+
488+ [` this.meta.rolldownVersion` ](https: // rolldown.rs/reference/Interface.PluginContextMeta#rolldownversion) は Rolldown ベースの Vite(つまり Vite 8+)でのみ利用できます。これを使用して、現在の Vite インスタンスが Rolldown ベースかどうかを検出できます:
489+
490+ ` ` ` ts
491+ function versionCheckPlugin(): Plugin {
492+ return {
493+ name: 'version-check',
494+ buildStart() {
495+ if (this.meta.rolldownVersion) {
496+ // Rolldown ベースの Vite で実行されている場合のみ何かを行う
497+ } else {
498+ // Rollup ベースの Vite で実行されている場合は別のことを行う
499+ }
500+ },
501+ }
502+ }
503+ ` ` `
504+
505+ :::
506+
480507## 出力バンドルメタデータ {#output- bundle- metadata}
481508
482509ビルド中、Vite は Rolldown のビルド出力オブジェクトに Vite 固有の ` viteMetadata` フィールドを追加します。
You can’t perform that action at this time.
0 commit comments