@@ -239,6 +239,16 @@ <h2>new URL(`./${dynamic}?abc`, import.meta.url)</h2>
239239 < code class ="dynamic-import-meta-url-2-query "> </ code >
240240</ p >
241241
242+ < h2 > new URL(`./${1 === 0 ? static : dynamic}?abc`, import.meta.url)</ h2 >
243+ < p >
244+ < img class ="dynamic-import-meta-url-img-1-ternary " />
245+ < code class ="dynamic-import-meta-url-1-ternary "> </ code >
246+ </ p >
247+ < p >
248+ < img class ="dynamic-import-meta-url-img-2-ternary " />
249+ < code class ="dynamic-import-meta-url-2-ternary "> </ code >
250+ </ p >
251+
242252< h2 > new URL(`non-existent`, import.meta.url)</ h2 >
243253< p >
244254 < code class ="non-existent-import-meta-url "> </ code >
@@ -468,6 +478,17 @@ <h3>assets in noscript</h3>
468478 testDynamicImportMetaUrlWithQuery ( 'icon' , 1 )
469479 testDynamicImportMetaUrlWithQuery ( 'asset' , 2 )
470480
481+ function testDynamicImportMetaUrlWithTernaryOperator ( name , i ) {
482+ // prettier-ignore
483+ const metaUrl = new URL ( `./nested/${ 1 === 0 ? 'failed' : name } .png?abc` , import . meta. url , )
484+ text ( `.dynamic-import-meta-url-${ i } -ternary` , metaUrl )
485+ document . querySelector ( `.dynamic-import-meta-url-img-${ i } -ternary` ) . src =
486+ metaUrl
487+ }
488+
489+ testDynamicImportMetaUrlWithTernaryOperator ( 'icon' , 1 )
490+ testDynamicImportMetaUrlWithTernaryOperator ( 'asset' , 2 )
491+
471492 {
472493 const name = 'test'
473494 const js = new URL ( `./nested/${ name } .js` , import . meta. url ) . href
0 commit comments