diff --git a/.changeset/ten-cars-end.md b/.changeset/ten-cars-end.md new file mode 100644 index 0000000000..66d13fd8a2 --- /dev/null +++ b/.changeset/ten-cars-end.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +added experimental RSPack support for build command in the repo scope diff --git a/packages/cli/src/commands/repo/build.ts b/packages/cli/src/commands/repo/build.ts index 7e6d235e7d..cd5e32dd06 100644 --- a/packages/cli/src/commands/repo/build.ts +++ b/packages/cli/src/commands/repo/build.ts @@ -31,6 +31,11 @@ import { createScriptOptionsParser } from './optionsParser'; export async function command(opts: OptionValues, cmd: Command): Promise { 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 { targetDir: pkg.dir, configPaths: (buildOptions.config as string[]) ?? [], writeStats: Boolean(buildOptions.stats), + rspack, }); }, }); diff --git a/packages/cli/src/lib/bundler/bundle.ts b/packages/cli/src/lib/bundler/bundle.ts index cb0322eb2c..7d88a2f97f 100644 --- a/packages/cli/src/lib/bundler/bundle.ts +++ b/packages/cli/src/lib/bundler/bundle.ts @@ -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) { diff --git a/packages/cli/src/lib/bundler/server.ts b/packages/cli/src/lib/bundler/server.ts index dc16a4577d..1b62c82ce5 100644 --- a/packages/cli/src/lib/bundler/server.ts +++ b/packages/cli/src/lib/bundler/server.ts @@ -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',