Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 133 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rspack/react-compiler-babel-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@babel/plugin-syntax-typescript": "^7.27.1",
"@rspack/cli": "1.3.15",
"@rspack/core": "1.3.15",
"@swc/react-compiler": "1.12.7",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"babel-loader": "^10.0.0",
Expand Down
15 changes: 10 additions & 5 deletions rspack/react-compiler-babel-ts/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
const { rspack } = require('@rspack/core');
const fs = require('node:fs');
const { isReactCompilerRequiredSync } = require('@swc/react-compiler');

/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: {
Expand All @@ -19,7 +22,7 @@ const config = {
{
loader: 'builtin:swc-loader',
options: {
sourceMap: true,
sourceMaps: true,
jsc: {
parser: {
syntax: 'typescript',
Expand All @@ -36,7 +39,7 @@ const config = {
{
loader: 'builtin:swc-loader',
options: {
sourceMap: true,
sourceMaps: true,
jsc: {
parser: {
syntax: 'typescript',
Expand All @@ -51,11 +54,13 @@ const config = {
},
},
},
{
loader: 'babel-loader',
},
],
},
{
test: (resouce) =>
/\.(jsx|tsx)$/.test(resouce) && isReactCompilerRequiredSync(fs.readFileSync(resouce)),
loader: 'babel-loader',
},
{
test: /\.(png|svg|jpg)$/,
type: 'asset/resource',
Expand Down
1 change: 1 addition & 0 deletions rspack/react-compiler-babel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@babel/plugin-syntax-jsx": "^7.27.1",
"@rspack/cli": "1.3.15",
"@rspack/core": "1.3.15",
"@swc/react-compiler": "1.12.7",
"babel-loader": "^10.0.0",
"babel-plugin-react-compiler": "0.0.0-experimental-cd3852a-20241229"
}
Expand Down
15 changes: 10 additions & 5 deletions rspack/react-compiler-babel/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
const { rspack } = require('@rspack/core');
const fs = require('node:fs');
const { isReactCompilerRequiredSync } = require('@swc/react-compiler');

/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: {
Expand All @@ -19,7 +22,7 @@ const config = {
{
loader: 'builtin:swc-loader',
options: {
sourceMap: true,
sourceMaps: true,
jsc: {
parser: {
syntax: 'ecmascript',
Expand All @@ -36,7 +39,7 @@ const config = {
{
loader: 'builtin:swc-loader',
options: {
sourceMap: true,
sourceMaps: true,
jsc: {
parser: {
syntax: 'ecmascript',
Expand All @@ -51,11 +54,13 @@ const config = {
},
},
},
{
loader: 'babel-loader',
},
],
},
{
test: (resouce) =>
/\.jsx$/.test(resouce) && isReactCompilerRequiredSync(fs.readFileSync(resouce)),
loader: 'babel-loader',
},
{
test: /\.(png|svg|jpg)$/,
type: 'asset/resource',
Expand Down