@@ -94,8 +94,6 @@ import {
9494 NEXT_PROJECT_ROOT ,
9595 NEXT_PROJECT_ROOT_DIST_CLIENT ,
9696} from './next-dir-paths'
97- import { getRspackCore , getRspackReactRefresh } from '../shared/lib/get-rspack'
98- import { RspackProfilingPlugin } from './webpack/plugins/rspack-profiling-plugin'
9997import getWebpackBundler from '../shared/lib/get-webpack-bundler'
10098import type { NextBuildContext } from './build-context'
10199import type { RootParamsLoaderOpts } from './webpack/loaders/next-root-params-loader'
@@ -177,9 +175,7 @@ const reactRefreshLoaderName =
177175 'next/dist/compiled/@next/react-refresh-utils/dist/loader'
178176
179177function getReactRefreshLoader ( ) {
180- return process . env . NEXT_RSPACK
181- ? getRspackReactRefresh ( ) . loader
182- : require . resolve ( reactRefreshLoaderName )
178+ return require . resolve ( reactRefreshLoaderName )
183179}
184180
185181export function attachReactRefresh (
@@ -697,11 +693,9 @@ export default async function getBaseWebpackConfig(
697693 '...' ,
698694 ]
699695
700- const reactRefreshEntry = isRspack
701- ? getRspackReactRefresh ( ) . entry
702- : require . resolve (
703- `next/dist/compiled/@next/react-refresh-utils/dist/runtime`
704- )
696+ const reactRefreshEntry = require . resolve (
697+ `next/dist/compiled/@next/react-refresh-utils/dist/runtime`
698+ )
705699
706700 const clientEntries = isClient
707701 ? ( {
@@ -1230,61 +1224,32 @@ export default async function getBaseWebpackConfig(
12301224 ( isNodeServer && config . experimental . serverMinification ) ) ,
12311225 minimizer : [
12321226 // Minify JavaScript
1233- isRspack
1234- ? new ( getRspackCore ( ) . SwcJsMinimizerRspackPlugin ) ( {
1235- // JS minimizer configuration
1236- minimizerOptions : {
1237- compress : {
1238- inline : 2 ,
1239- global_defs : {
1240- 'process.env.__NEXT_PRIVATE_MINIMIZE_MACRO_FALSE' : false ,
1241- } ,
1242- } ,
1243- mangle : ! noMangling && {
1244- reserved : [ 'AbortSignal' ] ,
1245- disableCharFreq : ! isClient ,
1246- } ,
1247- } ,
1248- } )
1249- : ( compiler : webpack . Compiler ) => {
1250- // @ts -ignore No typings yet
1251- const { MinifyPlugin } =
1252- require ( './webpack/plugins/minify-webpack-plugin/src' ) as typeof import ( './webpack/plugins/minify-webpack-plugin/src' )
1253- new MinifyPlugin ( {
1254- noMangling,
1255- disableCharFreq : ! isClient ,
1256- } ) . apply ( compiler )
1257- } ,
1227+ ( compiler : webpack . Compiler ) => {
1228+ // @ts -ignore No typings yet
1229+ const { MinifyPlugin } =
1230+ require ( './webpack/plugins/minify-webpack-plugin/src' ) as typeof import ( './webpack/plugins/minify-webpack-plugin/src' )
1231+ new MinifyPlugin ( {
1232+ noMangling,
1233+ disableCharFreq : ! isClient ,
1234+ } ) . apply ( compiler )
1235+ } ,
12581236 // Minify CSS
1259- // By default, Rspack uses LightningCSS for CSS minification.
1260- // Rspack uses css-minimizer-plugin by default for compatibility.
1261- isRspack &&
1262- ( process . env . __NEXT_TEST_MODE
1263- ? config . experimental . useLightningcss
1264- : config . experimental ?. useLightningcss === undefined ||
1265- config . experimental . useLightningcss )
1266- ? new ( getRspackCore ( ) . LightningCssMinimizerRspackPlugin ) ( {
1267- // CSS minimizer configuration
1268- minimizerOptions : {
1269- targets : supportedBrowsers ,
1237+ ( compiler : webpack . Compiler ) => {
1238+ const { CssMinimizerPlugin } =
1239+ require ( './webpack/plugins/css-minimizer-plugin' ) as typeof import ( './webpack/plugins/css-minimizer-plugin' )
1240+ new CssMinimizerPlugin ( {
1241+ postcssOptions : {
1242+ map : {
1243+ // `inline: false` generates the source map in a separate file.
1244+ // Otherwise, the CSS file is needlessly large.
1245+ inline : false ,
1246+ // `annotation: false` skips appending the `sourceMappingURL`
1247+ // to the end of the CSS file. Webpack already handles this.
1248+ annotation : false ,
12701249 } ,
1271- } )
1272- : ( compiler : webpack . Compiler ) => {
1273- const { CssMinimizerPlugin } =
1274- require ( './webpack/plugins/css-minimizer-plugin' ) as typeof import ( './webpack/plugins/css-minimizer-plugin' )
1275- new CssMinimizerPlugin ( {
1276- postcssOptions : {
1277- map : {
1278- // `inline: false` generates the source map in a separate file.
1279- // Otherwise, the CSS file is needlessly large.
1280- inline : false ,
1281- // `annotation: false` skips appending the `sourceMappingURL`
1282- // to the end of the CSS file. Webpack already handles this.
1283- annotation : false ,
1284- } ,
1285- } ,
1286- } ) . apply ( compiler )
12871250 } ,
1251+ } ) . apply ( compiler )
1252+ } ,
12881253 ] ,
12891254 } ,
12901255 context : dir ,
@@ -1983,16 +1948,7 @@ export default async function getBaseWebpackConfig(
19831948 }
19841949 ) ,
19851950 dev && new MemoryWithGcCachePlugin ( { maxGenerations : 5 } ) ,
1986- dev &&
1987- isClient &&
1988- ( isRspack
1989- ? // eslint-disable-next-line
1990- new ( getRspackReactRefresh ( ) as any ) ( {
1991- injectLoader : false ,
1992- injectEntry : false ,
1993- overlay : false ,
1994- } )
1995- : new ReactRefreshWebpackPlugin ( webpack ) ) ,
1951+ dev && isClient && new ReactRefreshWebpackPlugin ( webpack ) ,
19961952 // Makes sure `Buffer` and `process` are polyfilled in client and flight bundles (same behavior as webpack 4)
19971953 ( isClient || isEdgeServer ) &&
19981954 new bundler . ProvidePlugin ( {
@@ -2110,9 +2066,7 @@ export default async function getBaseWebpackConfig(
21102066 appDirEnabled : hasAppDir ,
21112067 clientRouterFilters,
21122068 } ) ,
2113- isRspack
2114- ? new RspackProfilingPlugin ( { runWebpackSpan } )
2115- : new ProfilingPlugin ( { runWebpackSpan, rootDir : dir } ) ,
2069+ new ProfilingPlugin ( { runWebpackSpan, rootDir : dir } ) ,
21162070 new WellKnownErrorsPlugin ( ) ,
21172071 isClient &&
21182072 new CopyFilePlugin ( {
@@ -2165,14 +2119,7 @@ export default async function getBaseWebpackConfig(
21652119 ! dev &&
21662120 isClient &&
21672121 config . experimental . cssChunking &&
2168- ( isRspack
2169- ? new ( getRspackCore ( ) . experiments . CssChunkingPlugin ) ( {
2170- strict : config . experimental . cssChunking === 'strict' ,
2171- nextjs : true ,
2172- } )
2173- : new CssChunkingPlugin (
2174- config . experimental . cssChunking === 'strict'
2175- ) ) ,
2122+ new CssChunkingPlugin ( config . experimental . cssChunking === 'strict' ) ,
21762123 telemetryPlugin ,
21772124 ! dev &&
21782125 isNodeServer &&
0 commit comments