File tree Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -31,11 +31,19 @@ Vite サーバーには共有プラグインパイプラインがありますが
3131
3232## フックを使用して新しい環境を登録する {#registering-new-environments-using-hooks}
3333
34- プラグインは、` config ` フックに新しい環境を追加できます(たとえば 、[ RSC] ( https://react.dev/blog/2023/03/22/react-labs-what-we-have-been-working-on-march-2023# react-server-components ) 用の個別のモジュールグラフを作成する場合など) :
34+ プラグインは、` config ` フックに新しい環境を追加できます。例えば 、[ RSC サポート ] ( /plugins/#vitejs-plugin-rsc ) では、 ` react-server ` 条件を含む個別のモジュールグラフを持つために追加の環境を使用します :
3535
3636``` ts
3737 config (config : UserConfig ) {
38- config .environments .rsc ?? = {}
38+ return {
39+ environments: {
40+ rsc: {
41+ resolve: {
42+ conditions: [' react-server' , ... defaultServerConditions ],
43+ },
44+ },
45+ },
46+ }
3947 }
4048```
4149
@@ -48,8 +56,16 @@ Vite サーバーには共有プラグインパイプラインがありますが
4856
4957``` ts
5058 configEnvironment (name : string , options : EnvironmentOptions ) {
59+ // rsc 環境に "workerd" 条件を追加
5160 if (name === ' rsc' ) {
52- options .resolve .conditions = // ...
61+ return {
62+ resolve: {
63+ conditions: [' workerd' ],
64+ },
65+ }
66+ }
67+ }
68+ ```
5369```
5470
5571## `hotUpdate` フック {#the-hotupdate-hook}
Original file line number Diff line number Diff line change @@ -213,6 +213,7 @@ HTML ファイルは、Vite プロジェクトの[中心](/guide/#index-html-and
213213- Vue JSX のサポート: [ @vitejs/plugin-vue-jsx ] ( https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx )
214214- React のサポート: [ @vitejs/plugin-react ] ( https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react )
215215- SWC を利用している React のサポート: [ @vitejs/plugin-react-swc ] ( https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-swc )
216+ - [ React サーバーコンポーネント(RSC)] ( https://react.dev/reference/rsc/server-components ) のサポート: [ @vitejs/plugin-rsc ] ( https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-rsc )
216217
217218詳しくは[ プラグインガイド] ( /plugins/ ) を確認してください。
218219
Original file line number Diff line number Diff line change @@ -24,6 +24,16 @@ esbuild と Babel を使用し、小さなパッケージフットプリント
2424
2525開発中は Babel を SWC に置き換えます。プロダクションビルド時には、プラグインを使用する場合は SWC+esbuild、それ以外は esbuild を使用します。非標準の React 拡張を必要としない大きなプロジェクトでは、コールドスタートやホットモジュールリプレースメント(HMR)が大幅に高速化されます。
2626
27+ ### [ @vitejs/plugin-rsc ] ( https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-rsc )
28+
29+ Vite はこのプラグインを通して [ React サーバーコンポーネント(RSC)] ( https://react.dev/reference/rsc/server-components ) をサポートしています。このプラグインは、React フレームワークが RSC 機能を統合するために使用できる低レベルのプリミティブを提供する [ Environment API] ( /guide/api-environment ) を利用しています。以下を実行してミニマルなスタンドアロン RSC アプリケーションを試すことができます:
30+
31+ ``` bash
32+ npm create vite@latest -- --template rsc
33+ ```
34+
35+ 詳しくは [ プラグインドキュメント] ( https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-rsc ) をお読みください。
36+
2737### [ @vitejs/plugin-legacy ] ( https://github.com/vitejs/vite/tree/main/packages/plugin-legacy )
2838
2939本番環境向けにレガシーブラウザーのサポートを提供します。
You can’t perform that action at this time.
0 commit comments