Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion turbopack/crates/turbopack-ecmascript/src/references/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1982,7 +1982,15 @@ where
&& meta_prop.as_str() == "url"
{
let pat = js_value_to_pattern(url);
if !pat.has_constant_parts() {
// Every alternative must constrain resolution. A constant fallback does not
// constrain another branch that can be an arbitrary runtime URL.
let has_constant_parts = match &pat {
Pattern::Alternatives(alternatives) => {
alternatives.iter().all(Pattern::has_constant_parts)
}
_ => pat.has_constant_parts(),
};
if !has_constant_parts {
let (args, hints) = explain_args(args);
handler.span_warn_with_code(
span,
Expand Down
Loading