import {
type EnvironmentConfig,
} from "@rsbuild/core";
import imagemin from "unplugin-imagemin";
//config code, here...
const webConfig: EnvironmentConfig = {
html: { template: config.htmlTemplate },
source: { entry: { index: config.entry } },
output: {
target: "web",
polyfill: "usage",
legalComments: "none",
assetPrefix: process.env?.VERCEL_PROJECT_PRODUCTION_URL
? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
: "/",
distPath: {
root: config.output.distPath,
svg: "static/img",
image: "static/img",
},
minify: config.isProdBuild,
sourceMap: !config.isProdBuild,
filename: config.isProdBuild
? {
js: "[name].[contenthash:8].js",
css: "[name].[contenthash:8].css",
font: "[name][ext]",
image: "[name].[contenthash:8][ext]",
svg: "[name].[contenthash:8][ext]",
assets: "[name].[contenthash:8][ext]",
}
: {
js: "[name].js",
css: "[name].css",
font: "[name][ext]",
image: "[name][ext]",
svg: "[name][ext]",
assets: "[name][ext]",
},
},
performance: {
removeConsole: config.isProdBuild,
chunkSplit: {
strategy: "custom",
splitChunks: {
chunks: "all",
minChunks: 1,
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: "lib-vendors",
chunks: "all",
priority: 10,
reuseExistingChunk: true,
},
react: {
test: /node_modules[\\/](?:react|react-dom|scheduler|react-refresh)[\\/]/,
name: "lib-react",
chunks: "all",
priority: 20,
},
router: {
test: /node_modules[\\/](?:react-router|react-router-dom|history|@remix-run[\\/]router)[\\/]/,
name: "lib-router",
chunks: "all",
priority: 20,
},
utils: {
name: "lib-common",
minChunks: 2,
chunks: "all",
priority: 5,
reuseExistingChunk: true,
},
},
},
},
preload: {
type: "all-chunks",
},
prefetch: {
type: "all-chunks",
},
},
tools: {
rspack(_config, utils) {
_config.plugins ??= [];
_config.plugins.push(imagemin.webpack({}))
},
},
};
Steps to reproduce
rsbuild devorrsbuild buildWhat is expected?
successfully compressed images
What is actually happening?
System Info
System: OS: macOS 26.3 CPU: (10) arm64 Apple M2 Pro Memory: 1.89 GB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 25.6.0 - /opt/homebrew/bin/node Yarn: 1.22.22 - /usr/local/bin/yarn npm: 11.8.0 - /opt/homebrew/bin/npm pnpm: 10.28.0 - /usr/local/bin/pnpm bun: 1.3.5 - /Users/lazuee/.bun/bin/bun Browsers: Chrome: 144.0.7559.110 Safari: 26.3 npmPackages: @babel/preset-env: ^7.29.0 => 7.29.0 @babel/preset-react: ^7.28.5 => 7.28.5 @rsbuild/core: ^1.7.3 => 1.7.3 @rsbuild/plugin-babel: ^1.1.0 => 1.1.0 @rsbuild/plugin-react: ^1.4.5 => 1.4.5 react: ^19.2.4 => 19.2.4 react-dom: ^19.2.4 => 19.2.4 react-router: ^7.13.0 => 7.13.0 unplugin-imagemin: ^0.7.0 => 0.7.0Any additional comments?
No response