Skip to content

Commit

Permalink
Revert "chore: integrate rspack plugin"
Browse files Browse the repository at this point in the history
This reverts commit cdc8bf7.
  • Loading branch information
hardfist committed Jan 27, 2025
1 parent cdc8bf7 commit b551229
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 182 deletions.
7 changes: 1 addition & 6 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ import { WellKnownErrorsPlugin } from './webpack/plugins/wellknown-errors-plugin
import { regexLikeCss } from './webpack/config/blocks/css'
import { CopyFilePlugin } from './webpack/plugins/copy-file-plugin'
import { ClientReferenceManifestPlugin } from './webpack/plugins/flight-manifest-plugin'
import { FlightClientEntryPlugin as NextFlightClientEntryPlugin } from './webpack/plugins/flight-client-entry-plugin'
import { RspackFlightClientEntryPlugin } from './webpack/plugins/rspack-flight-client-entry-plugin'
import { FlightClientEntryPlugin } from './webpack/plugins/flight-client-entry-plugin'
import { NextTypesPlugin } from './webpack/plugins/next-types-plugin'
import type {
Feature,
Expand Down Expand Up @@ -342,10 +341,6 @@ export default async function getBaseWebpackConfig(

const isRspack = Boolean(process.env.NEXT_RSPACK)

const FlightClientEntryPlugin = isRspack && process.env.BUILTIN_FLIGHT_CLIENT_ENTRY_PLUGIN
? RspackFlightClientEntryPlugin
: NextFlightClientEntryPlugin;

// If the current compilation is aimed at server-side code instead of client-side code.
const isNodeOrEdgeCompilation = isNodeServer || isEdgeServer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ const flightClientModuleLoader: webpack.LoaderDefinitionFunction =
.join('\n')
}

if (process.env.BUILTIN_FLIGHT_CLIENT_ENTRY_PLUGIN) {
const rscModuleInformationJson = JSON.stringify(buildInfo.rsc);
source += `\n/* __rspack_internal_rsc_module_information_do_not_use__ ${rscModuleInformationJson} */`;
}

return this.callback(null, source, sourceMap)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,22 +134,13 @@ ${JSON.stringify(ref)},
}
}

if (process.env.BUILTIN_FLIGHT_CLIENT_ENTRY_PLUGIN) {
const rscModuleInformationJson = JSON.stringify(buildInfo.rsc);
esmSource += `\n/* __rspack_internal_rsc_module_information_do_not_use__ ${rscModuleInformationJson} */`;
}

return this.callback(null, esmSource, sourceMap)
} else if (assumedSourceType === 'commonjs') {
let cjsSource = `\
const { createProxy } = require("${MODULE_PROXY_PATH}")
module.exports = createProxy(${stringifiedResourceKey})
`
if (process.env.BUILTIN_FLIGHT_CLIENT_ENTRY_PLUGIN) {
const rscModuleInformationJson = JSON.stringify(buildInfo.rsc);
cjsSource += `\n/* __rspack_internal_rsc_module_information_do_not_use__ ${rscModuleInformationJson} */`;
}

return this.callback(null, cjsSource, sourceMap)
}
Expand All @@ -163,15 +154,9 @@ module.exports = createProxy(${stringifiedResourceKey})
}
}

let replacedSource = source.replace(
const replacedSource = source.replace(
RSC_MOD_REF_PROXY_ALIAS,
MODULE_PROXY_PATH
)

if (process.env.BUILTIN_FLIGHT_CLIENT_ENTRY_PLUGIN) {
const rscModuleInformationJson = JSON.stringify(buildInfo.rsc);
replacedSource += `\n/* __rspack_internal_rsc_module_information_do_not_use__ ${rscModuleInformationJson} */`;
}

this.callback(null, replacedSource, sourceMap)
}

This file was deleted.

0 comments on commit b551229

Please sign in to comment.