Skip to content

[Bug]: Failed to run the build with "pnpm build:start" - works fine in dev mode #13799

@abhidatta0

Description

@abhidatta0

System Info

System:
OS: macOS 26.0
CPU: (8) arm64 Apple M2
Memory: 189.27 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.11.0 - /Users/abhirup/.nvm/versions/node/v24.11.0/bin/node
npm: 11.6.1 - /Users/abhirup/.nvm/versions/node/v24.11.0/bin/npm
pnpm: 10.24.0 - /Users/abhirup/.nvm/versions/node/v24.11.0/bin/pnpm
bun: 1.3.1 - /Users/abhirup/.bun/bin/bun
Watchman: 2025.09.15.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 147.0.7727.102
Firefox: 149.0.2
Safari: 26.0
npmPackages:
@rspack/cli: ~1.2.0 => 1.2.8
@rspack/core: ~1.2.0 => 1.2.8
@rspack/plugin-react-refresh: ~1.0.1 => 1.0.3

Details

rspack-issue.mp4

As demonstrated in the video: pnpm start (the dev mode ) works but when trying to run the prod build it fails.

rspack.config.ts

import * as path from "node:path";
import { defineConfig } from "@rspack/cli";
import { rspack } from "@rspack/core";
import * as RefreshPlugin from "@rspack/plugin-react-refresh";
import { ModuleFederationPlugin } from "@module-federation/enhanced/rspack";

import { mfConfig } from "./module-federation.config";

const isDev = process.env.NODE_ENV === "development";

// Target browsers, see: https://github.com/browserslist/browserslist
const targets = ["chrome >= 87", "edge >= 88", "firefox >= 78", "safari >= 14"];

export default defineConfig({
context: __dirname,
entry: {
main: "./src/index.ts",
},
resolve: {
extensions: ["...", ".ts", ".tsx", ".jsx"],
},

devServer: {
port: 8081,
historyApiFallback: true,
watchFiles: [path.resolve(__dirname, "src")],
},
output: {
// You need to set a unique value that is not equal to other applications
uniqueName: "remote",
// publicPath must be configured if using manifest
publicPath: "http://localhost:8081/",
},

experiments: {
css: true,
},

module: {
rules: [
{
test: /.svg$/,
type: "asset",
},
{
test: /.css$/,
use: ["postcss-loader"],
type: "css",
},
{
test: /.(jsx?|tsx?)$/,
use: [
{
loader: "builtin:swc-loader",
options: {
jsc: {
parser: {
syntax: "typescript",
tsx: true,
},
transform: {
react: {
runtime: "automatic",
development: isDev,
refresh: isDev,
},
},
},
env: { targets },
},
},
],
},
],
},
plugins: [
new rspack.HtmlRspackPlugin({
template: "./index.html",
}),
new ModuleFederationPlugin(mfConfig),
isDev ? new RefreshPlugin() : null,
].filter(Boolean),
optimization: {
minimizer: [
new rspack.SwcJsMinimizerRspackPlugin(),
new rspack.LightningCssMinimizerRspackPlugin({
minimizerOptions: { targets },
}),
],
},
});

Reproduce link

No response

Reproduce Steps

  1. Run pnpm start - it will work fine
  2. Run "pnpm build && pnpm build:start" - it will fail

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions