@@ -18,6 +18,10 @@ import rtlCss from 'postcss-rtlcss';
1818import autoprefixer from 'autoprefixer' ;
1919import discardFonts from 'postcss-discard-font-face' ;
2020import type ReactRefreshPluginType from '@pmmmwh/react-refresh-webpack-plugin' ;
21+ import {
22+ defineReactCompilerLoaderOption ,
23+ reactCompilerLoader ,
24+ } from 'react-compiler-webpack' ;
2125import tailwindcss from 'tailwindcss' ;
2226import { loadBuildTypesConfig } from '../lib/build-type' ;
2327import {
@@ -36,6 +40,7 @@ import { getSwcLoader } from './utils/loaders/swcLoader';
3640import { getVariables } from './utils/config' ;
3741import { ManifestPlugin } from './utils/plugins/ManifestPlugin' ;
3842import { getLatestCommit } from './utils/git' ;
43+ import { reactCompilerOptions } from './constants' ;
3944
4045const buildTypes = loadBuildTypesConfig ( ) ;
4146const { args, cacheKey, features } = parseArgv ( argv . slice ( 2 ) , buildTypes ) ;
@@ -307,13 +312,27 @@ const config = {
307312 {
308313 test : / \. (?: t s | m t s | t s x ) $ / u,
309314 exclude : NODE_MODULES_RE ,
310- use : [ tsxLoader , codeFenceLoader ] ,
315+ use : [
316+ {
317+ loader : reactCompilerLoader ,
318+ options : defineReactCompilerLoaderOption ( reactCompilerOptions ) ,
319+ } ,
320+ tsxLoader ,
321+ codeFenceLoader ,
322+ ] ,
311323 } ,
312324 // own javascript, and own javascript with jsx
313325 {
314326 test : / \. (?: j s | m j s | j s x ) $ / u,
315327 exclude : NODE_MODULES_RE ,
316- use : [ jsxLoader , codeFenceLoader ] ,
328+ use : [
329+ {
330+ loader : reactCompilerLoader ,
331+ options : defineReactCompilerLoaderOption ( reactCompilerOptions ) ,
332+ } ,
333+ jsxLoader ,
334+ codeFenceLoader ,
335+ ] ,
317336 } ,
318337 // vendor javascript. We must transform all npm modules to ensure browser
319338 // compatibility.
0 commit comments