add support for experimental rspack bundler for the cli repo build command

Signed-off-by: Adrian Soovary <adrian.soovary@otto.de>
This commit is contained in:
Adrian Soovary
2024-12-06 11:14:31 +01:00
parent 3f72c6c4ca
commit dcd99d2027
4 changed files with 23 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
added experimental RSPack support for build command in the repo scope
+6
View File
@@ -31,6 +31,11 @@ import { createScriptOptionsParser } from './optionsParser';
export async function command(opts: OptionValues, cmd: Command): Promise<void> {
let packages = await PackageGraph.listTargetPackages();
const shouldUseRspack = Boolean(process.env.EXPERIMENTAL_RSPACK);
const rspack = shouldUseRspack
? (require('@rspack/core') as typeof import('@rspack/core').rspack)
: undefined;
if (opts.since) {
const graph = PackageGraph.fromPackages(packages);
@@ -111,6 +116,7 @@ export async function command(opts: OptionValues, cmd: Command): Promise<void> {
targetDir: pkg.dir,
configPaths: (buildOptions.config as string[]) ?? [],
writeStats: Boolean(buildOptions.stats),
rspack,
});
},
});
+6
View File
@@ -119,6 +119,12 @@ export async function buildBundle(options: BuildOptions) {
);
}
if (rspack) {
console.log(
chalk.yellow(`⚠️ WARNING: Using experimental RSPack bundler.`),
);
}
const { stats } = await build(configs, isCi, rspack);
if (!stats) {
+6
View File
@@ -233,6 +233,12 @@ DEPRECATION WARNING: React Router Beta is deprecated and support for it will be
? require('@rspack/dev-server').RspackDevServer
: WebpackDevServer;
if (rspack) {
console.log(
chalk.yellow(`⚠️ WARNING: Using experimental RSPack dev server.`),
);
}
const publicPaths = await resolveOptionalBundlingPaths({
entry: 'src/index-public-experimental',
dist: 'dist/public',