rspack: [Bug]: Build hangs when using rspack.CssExtractRspackPlugin.loader with builtin:swc-loader set to env.mode: usage
System Info
System: OS: macOS 14.7 CPU: (8) arm64 Apple M2 Memory: 52.23 MB / 24.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 20.17.0 - ~/.nodebrew/current/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 10.8.2 - ~/.nodebrew/current/bin/npm pnpm: 8.15.3 - ~/.nodebrew/current/bin/pnpm bun: 1.0.2 - /opt/homebrew/bin/bun Browsers: Chrome: 130.0.6723.70 Edge: 130.0.2849.56 Safari: 18.0 npmPackages: @rspack/cli: ^1.0.14 => 1.0.14 @rspack/core: ^1.0.14 => 1.0.14
Details
Build hangs when using rspack.CssExtractRspackPlugin.loader with builtin:swc-loader set to env.mode: usage. The build succeeds when env.mode is set to entry.
{
mode: "development",
entry: "./src/index.js",
output: {
path: "./dist",
},
module: {
rules :[
{
test: /\.css$/,
use: [
{
loader: rspack.CssExtractRspackPlugin.loader,
},
{
loader: "css-loader",
},
],
},
{
test: /\.js$/,
use: {
loader: "builtin:swc-loader",
options: {
jsc: {
parser: {
syntax: "ecmascript",
},
},
env: {
mode: process.env.ENV_MODE, // "entry" or "usage"
coreJs: require("core-js/package.json").version,
targets: ["IE 11"],
},
},
},
type: "javascript/auto"
},
],
},
experiments: {
css: false
},
plugins: [
new rspack.CssExtractRspackPlugin({
filename: `[name].[chunkhash:10].css`,
}),
],
}
Reproduce link
https://github.com/Thiry1/rspack-bug-repro/commit/ae6055b36cf62e19861a32023a1d663cbfe37f36
Reproduce Steps
- clone repro repo
- git switch swc-mode
- npm i
- npm run build:mode:usage
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 15 (12 by maintainers)
Commits related to this issue
- Possibly fixes build stalling issue (#90757) ## About The Pull Request Per the discord: rspack has been randomly freezing during build. This is possibly related to https://github.com/web-infra-dev/rs... — committed to tgstation/tgstation by jlsnow301 2 years ago
- Possibly fixes build stalling issue (#90757) ## About The Pull Request Per the discord: rspack has been randomly freezing during build. This is possibly related to https://github.com/web-infra-dev/rs... — committed to NovaSector/NovaSector by jlsnow301 2 years ago
- Possibly fixes build stalling issue (#90757) ## About The Pull Request Per the discord: rspack has been randomly freezing during build. This is possibly related to https://github.com/web-infra-dev/rs... — committed to NovaSector/NovaSector by jlsnow301 2 years ago
- Possibly fixes build stalling issue (#90757) ## About The Pull Request Per the discord: rspack has been randomly freezing during build. This is possibly related to https://github.com/web-infra-dev/rs... — committed to Shadow-Quill/Bubberstation by jlsnow301 2 years ago
- Possibly fixes build stalling issue (#90757) ## About The Pull Request Per the discord: rspack has been randomly freezing during build. This is possibly related to https://github.com/web-infra-dev/rs... — committed to Fluffy-Frontier/FluffySTG by jlsnow301 2 years ago
- Possibly fixes build stalling issue (#90757) ## About The Pull Request Per the discord: rspack has been randomly freezing during build. This is possibly related to https://github.com/web-infra-dev/rs... — committed to effigy-se/effigy by jlsnow301 2 years ago
- Possibly fixes build stalling issue (#90757) ## About The Pull Request Per the discord: rspack has been randomly freezing during build. This is possibly related to https://github.com/web-infra-dev/rs... — committed to Metekillot/TekquiemSS13 by jlsnow301 2 years ago
We’ll fix this soon, sorry for the delay
Yeah, should keep module’s format as is
I think it is no related to this issue.
I guess the potential cause of it is that the core-js code is injected to core-js itself, thus created a cyclic dependencies, $ is not initialized when executing.
You can try avoid using swc-loader for
node_modules/core-jspackageI’ve found that we can avoid the issue by setting isModule to “unknown”.
I’m fixing it, during this time, you can ignore javascript in core-js package to escape this issue