@@ -18,10 +18,6 @@ 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' ;
2521import tailwindcss from 'tailwindcss' ;
2622import { loadBuildTypesConfig } from '../lib/build-type' ;
2723import {
@@ -38,7 +34,11 @@ import { transformManifest } from './utils/plugins/ManifestPlugin/helpers';
3834import { parseArgv , getDryRunMessage } from './utils/cli' ;
3935import { getCodeFenceLoader } from './utils/loaders/codeFenceLoader' ;
4036import { getSwcLoader } from './utils/loaders/swcLoader' ;
41- import { getVariables , reactCompilerOptions } from './utils/config' ;
37+ import {
38+ getReactCompilerLoader ,
39+ getReactCompilerLogger ,
40+ } from './utils/loaders/reactCompilerLoader' ;
41+ import { getVariables } from './utils/config' ;
4242import { ManifestPlugin } from './utils/plugins/ManifestPlugin' ;
4343import { getLatestCommit } from './utils/git' ;
4444
@@ -215,13 +215,29 @@ if (args.progress) {
215215 const { ProgressPlugin } = require ( 'webpack' ) ;
216216 plugins . push ( new ProgressPlugin ( ) ) ;
217217}
218+
219+ if ( args . reactCompilerVerbose ) {
220+ plugins . push ( {
221+ apply ( compiler ) {
222+ compiler . hooks . done . tap ( 'ReactCompilerStatsPlugin' , ( ) => {
223+ const logger = getReactCompilerLogger ( ) ;
224+ logger . logSummary ( ) ;
225+ } ) ;
226+ } ,
227+ } as WebpackPluginInstance ) ;
228+ }
229+
218230// #endregion plugins
219231
220232const swcConfig = { args, browsersListQuery, isDevelopment } ;
221233const tsxLoader = getSwcLoader ( 'typescript' , true , safeVariables , swcConfig ) ;
222234const jsxLoader = getSwcLoader ( 'ecmascript' , true , safeVariables , swcConfig ) ;
223235const npmLoader = getSwcLoader ( 'ecmascript' , false , { } , swcConfig ) ;
224236const cjsLoader = getSwcLoader ( 'ecmascript' , false , { } , swcConfig , 'commonjs' ) ;
237+ const reactCompilerLoader = getReactCompilerLoader (
238+ '17' ,
239+ args . reactCompilerVerbose ,
240+ ) ;
225241
226242const config = {
227243 entry,
@@ -327,12 +343,7 @@ const config = {
327343 {
328344 test : / (? ! \. (?: t e s t | s t o r i e s | c o n t a i n e r ) ) \. (?: m ? [ j t ] s | [ j t ] s x ) $ / u,
329345 include : UI_DIR_RE ,
330- use : [
331- {
332- loader : reactCompilerLoader ,
333- options : defineReactCompilerLoaderOption ( reactCompilerOptions ) ,
334- } ,
335- ] ,
346+ use : [ reactCompilerLoader ] ,
336347 } ,
337348 // own typescript, and own typescript with jsx
338349 {
0 commit comments