web-infra-dev
rspack
BlogDocsChangelog

fix(context-replacement): only apply changes when regex matches

#12657Merged
Comparing
agneym:fix/context-replacement-regex-matching
(
2c9cfd8
) with
main
(
d02192f
)
CodSpeed Performance Gauge
0%
Untouched
16
Skipped
1

Benchmarks

Skipped (1)

Passed

js@external getResolve
tests/bench/ts-react.bench.ts::TypeScript React project
CodSpeed Performance Gauge
+2%
1.5 ms1.4 ms
bundle@threejs-development
xtask/benchmark/benches/groups/bundle.rs::bundle::bundle_benchmark::bundle
CodSpeed Performance Gauge
+2%
739 ms727.5 ms
rust@build_chunk_graph
xtask/benchmark/benches/groups/build_chunk_graph.rs::chunk_graph::build_chunk_graph_benchmark
CodSpeed Performance Gauge
+1%
116 ms114.8 ms
js@stats.toJson()
tests/bench/ts-react.bench.ts::TypeScript React project
CodSpeed Performance Gauge
+1%
23.4 ms23.2 ms
bundle@threejs-production
xtask/benchmark/benches/groups/bundle.rs::bundle::bundle_benchmark::bundle
CodSpeed Performance Gauge
+1%
1.6 s1.5 s
bundle@threejs-production-sourcemap
xtask/benchmark/benches/groups/bundle.rs::bundle::bundle_benchmark::bundle
CodSpeed Performance Gauge
+1%
2 s2 s
js@record module
tests/bench/ts-react.bench.ts::TypeScript React project
CodSpeed Performance Gauge
+1%
1.9 ms1.9 ms
bundle@basic-react-production
xtask/benchmark/benches/groups/bundle.rs::bundle::bundle_benchmark::bundle
CodSpeed Performance Gauge
0%
548.6 ms547.1 ms
bundle@basic-react-development
xtask/benchmark/benches/groups/bundle.rs::bundle::bundle_benchmark::bundle
CodSpeed Performance Gauge
0%
347.2 ms346.8 ms
bundle@basic-react-production-sourcemap
xtask/benchmark/benches/groups/bundle.rs::bundle::bundle_benchmark::bundle
CodSpeed Performance Gauge
0%
703.8 ms703.1 ms
js@Traverse module graph by connections
tests/bench/ts-react.bench.ts::TypeScript React project
CodSpeed Performance Gauge
0%
261.1 µs261.7 µs
js@record chunk group
tests/bench/ts-react.bench.ts::TypeScript React project
CodSpeed Performance Gauge
0%
78.2 µs78.5 µs
js@Traverse module graph by dependencies
tests/bench/ts-react.bench.ts::TypeScript React project
CodSpeed Performance Gauge
-1%
518.9 µs523.3 µs
js@collect imported identifiers
tests/bench/ts-react.bench.ts::TypeScript React project
CodSpeed Performance Gauge
-1%
207.9 µs209.9 µs
js@Traverse compilation.modules
tests/bench/ts-react.bench.ts::TypeScript React project
CodSpeed Performance Gauge
-2%
64.5 µs65.6 µs
js@is css mod
tests/bench/ts-react.bench.ts::TypeScript React project
CodSpeed Performance Gauge
-2%
86.6 µs88.1 µs

Commits

Click on a commit to change the comparison range
Base
main
d02192f
+0.1%
fix(ContextReplacementPlugin): only apply changes when regex matches The plugin was applying transformations (recursive, regExp, critical) to all require.context() calls regardless of whether the configured regex pattern matched the request. This fix ensures all transformations only apply when the regex successfully matches. Closes #12656
2c9cfd8
6 days ago
by agneym
© 2026 CodSpeed Technology
Home Terms Privacy Docs