@@ -8,9 +8,17 @@ const { LANGUAGES, LANGUAGES_SSR } = require('./src/modules/constants');
88const workspaceRoot = path . join ( __dirname , '../' ) ;
99
1010/**
11- * @type {'legacy' | 'sync' | 'concurrent' }
11+ * https://github.com/zeit/next.js/blob/287961ed9142a53f8e9a23bafb2f31257339ea98/packages/next/next-server/server/config.ts#L10
12+ * @typedef {'legacy' | 'blocking' | 'concurrent' } ReactRenderMode
13+ * legacy - ReactDOM.render(<App />)
14+ * legacy-strict - ReactDOM.render(<React.StrictMode><App /></React.StrictMode>, Element)
15+ * blocking - ReactDOM.createSyncRoot(Element).render(<App />)
16+ * concurrent - ReactDOM.createRoot(Element).render(<App />)
17+ * @type {ReactRenderMode | 'legacy-strict' }
1218 */
1319const reactMode = 'legacy' ;
20+ // eslint-disable-next-line no-console
21+ console . log ( `Using React '${ reactMode } ' mode.` ) ;
1422
1523module . exports = {
1624 typescript : {
@@ -45,10 +53,6 @@ module.exports = {
4553 config . resolve . alias [ 'react-dom$' ] = 'react-dom/profiling' ;
4654 config . resolve . alias [ 'scheduler/tracing' ] = 'scheduler/tracing-profiling' ;
4755
48- if ( reactMode !== 'legacy' ) {
49- config . resolve . alias [ 'react-transition-group' ] = '@material-ui/react-transition-group' ;
50- }
51-
5256 // next includes node_modules in webpack externals. Some of those have dependencies
5357 // on the aliases defined above. If a module is an external those aliases won't be used.
5458 // We need tell webpack to not consider those packages as externals.
@@ -179,5 +183,7 @@ module.exports = {
179183 { source : '/api/:rest*' , destination : '/api-docs/:rest*' } ,
180184 ] ;
181185 } ,
186+ reactMode : reactMode . startsWith ( 'legacy' ) ? 'legacy' : reactMode ,
182187 } ,
188+ reactStrictMode : reactMode === 'legacy-strict' ,
183189} ;
0 commit comments