web-infra-dev
rspack
BlogDocsChangelog

fix(javascript): prevent import.meta.url replacement in web target

#12266
Comparing
MIreland:fix/import-meta-url-web
(
2dceafe
) with
main
(
5041023
)
CodSpeed Performance Gauge
0%
Untouched
17

Benchmarks

Passed

rust@build_chunk_graph_parallel
xtask/benchmark/benches/groups/build_chunk_graph.rs::chunk_graph::build_chunk_graph_benchmark
CodSpeed Performance Gauge
+3%
105 ms102.3 ms
bundle@threejs-development
xtask/benchmark/benches/groups/bundle.rs::bundle::bundle_benchmark::bundle
CodSpeed Performance Gauge
+2%
771.4 ms759.9 ms
rust@build_chunk_graph
xtask/benchmark/benches/groups/build_chunk_graph.rs::chunk_graph::build_chunk_graph_benchmark
CodSpeed Performance Gauge
+1%
117.4 ms115.8 ms
js@Traverse compilation.modules
tests/bench/ts-react.bench.ts::TypeScript React project
CodSpeed Performance Gauge
+1%
65.6 µs64.7 µs
js@record module
tests/bench/ts-react.bench.ts::TypeScript React project
CodSpeed Performance Gauge
+1%
1.9 ms1.9 ms
bundle@threejs-production-sourcemap
xtask/benchmark/benches/groups/bundle.rs::bundle::bundle_benchmark::bundle
CodSpeed Performance Gauge
+1%
2.1 s2.1 s
bundle@threejs-production
xtask/benchmark/benches/groups/bundle.rs::bundle::bundle_benchmark::bundle
CodSpeed Performance Gauge
+1%
1.6 s1.6 s
js@stats.toJson()
tests/bench/ts-react.bench.ts::TypeScript React project
CodSpeed Performance Gauge
+1%
24.3 ms24.1 ms
js@record chunk group
tests/bench/ts-react.bench.ts::TypeScript React project
CodSpeed Performance Gauge
+1%
77.9 µs77.4 µs
js@external getResolve
tests/bench/ts-react.bench.ts::TypeScript React project
CodSpeed Performance Gauge
0%
1.5 ms1.5 ms
bundle@basic-react-production
xtask/benchmark/benches/groups/bundle.rs::bundle::bundle_benchmark::bundle
CodSpeed Performance Gauge
0%
570.7 ms569.5 ms
bundle@basic-react-production-sourcemap
xtask/benchmark/benches/groups/bundle.rs::bundle::bundle_benchmark::bundle
CodSpeed Performance Gauge
0%
725 ms725.5 ms
bundle@basic-react-development
xtask/benchmark/benches/groups/bundle.rs::bundle::bundle_benchmark::bundle
CodSpeed Performance Gauge
0%
373 ms374.1 ms
js@Traverse module graph by connections
tests/bench/ts-react.bench.ts::TypeScript React project
CodSpeed Performance Gauge
0%
258.2 µs259.2 µs
js@Traverse module graph by dependencies
tests/bench/ts-react.bench.ts::TypeScript React project
CodSpeed Performance Gauge
0%
514.9 µs517 µs
js@collect imported identifiers
tests/bench/ts-react.bench.ts::TypeScript React project
CodSpeed Performance Gauge
-1%
208.2 µs209.5 µs
js@is css mod
tests/bench/ts-react.bench.ts::TypeScript React project
CodSpeed Performance Gauge
-1%
87.1 µs88.3 µs

Commits

Click on a commit to change the comparison range
Base
main
5041023
+0.61%
fix: check if module is ES module before using import.meta.url The script must be an ES module to use import.meta.url. We cannot use supports_document() to determine this. This change adds a check for parser.is_esm before handling import.meta.url in both evaluate_identifier and member methods.
396aa66
1 month ago
by MIreland
+0.07%
fix(javascript): preserve import.meta.url in destructuring for web targets When destructuring import.meta in ES modules targeting web environments, preserve import.meta.url using a getter function instead of replacing it with a file:// URL. This ensures the browser can resolve it to the actual script URL at runtime.
54b40cf
1 month ago
by MIreland
-0.22%
fix(test): update import-meta-url-web test to work with ES module output - Add export statement to make test file an ES module - Configure rspack to output ES module format (outputModule, module, chunkFormat) - Update test expectations to verify import.meta.url is preserved - Add test.config.js for moduleScope configuration
2dceafe
1 month ago
by MIreland
© 2026 CodSpeed Technology
Home Terms Privacy Docs