[Typo]: The alternative way to configure react compiler with vitejs doesn't work
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 11.8k
- フォーク
- 7.9k
- 平均マージ
- 1日 11時間
- マージ済み PR(30日)
- 11
説明
Summary
The alternative way to configure react-compiler with Vitejs, which is to declare the Babel configuration separately, doesn't actually work.
Page
https://react.dev/learn/react-compiler/installation#vite
Details
Note that I'm talking about a TypeScript scenario.
I figure this is because of the default filter parameter which is specfieid to be jsx (you can find it here).
For the fix, it seems the babel config provided for react-router case works well with vite-plugin-react. so maybe we can use that, it would look something like this:
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import babel from 'vite-plugin-babel';
const ReactCompilerConfig = { /* ... */ };
export default defineConfig({
plugins: [
react(),
babel({
filter: /\.[jt]sx?$/,
babelConfig: {
presets: ["@babel/preset-typescript"],
plugins: [
["babel-plugin-react-compiler", ReactCompilerConfig],
],
},
}),
],
});
Also, maybe it's not a good idea to talk about it here, but I suggest to also have a guide for how the configuration should look like for a vite user who uses JavaScript (jsx) instead of TypeScript because apparently removing the TypeScript babel preset doesn't turn it into a JavaScript configuration; it requires more adjustments.
so maybe considering all of this, we are better off just removing the alternative, since it causes more problems than it solves 😅
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
react.dev/learn/react-compiler/installation#vite から始め、代替の Babel 設定を #usage-with-react-router の React Router の例と比較します。TypeScript と JavaScript/Vite のケースを確認し、その後、ドキュメントに記載されたセットアップが動作するようにページを更新するか、代替案を削除します。最終的な手順と例に一貫性があることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, react, typescript, vite
- 領域
- documentation
- issue の種類
- ドキュメント
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100