@@ -1268,37 +1268,28 @@ export function getModuleCode(html, replacements, loaderContext, options) {
12681268 let needHelperImport = false ;
12691269
12701270 for ( const item of replacements ) {
1271- const { runtime, importName, replacementName, isValueQuoted, hash } = item ;
1272-
1273- if ( typeof runtime === "undefined" || runtime === true ) {
1274- const getUrlOptions = [ ]
1275- . concat ( hash ? [ `hash: ${ JSON . stringify ( hash ) } ` ] : [ ] )
1276- . concat ( isValueQuoted ? [ ] : "maybeNeedQuotes: true" ) ;
1277- const preparedOptions =
1278- getUrlOptions . length > 0 ? `, { ${ getUrlOptions . join ( ", " ) } }` : "" ;
1279-
1280- const needHelperFn = getUrlOptions . length > 0 ;
1281-
1282- if ( needHelperFn ) {
1283- if ( ! needHelperImport ) {
1284- needHelperImport = true ;
1285- }
1286-
1287- replacersCode += `var ${ replacementName } = ${ GET_SOURCE_FROM_IMPORT_NAME } (${ importName } ${ preparedOptions } );\n` ;
1271+ const { importName, replacementName, isValueQuoted, hash } = item ;
1272+ const getUrlOptions = [ ]
1273+ . concat ( hash ? [ `hash: ${ JSON . stringify ( hash ) } ` ] : [ ] )
1274+ . concat ( isValueQuoted ? [ ] : "maybeNeedQuotes: true" ) ;
1275+ const preparedOptions =
1276+ getUrlOptions . length > 0 ? `, { ${ getUrlOptions . join ( ", " ) } }` : "" ;
1277+
1278+ const needHelperFn = getUrlOptions . length > 0 ;
1279+
1280+ if ( needHelperFn ) {
1281+ if ( ! needHelperImport ) {
1282+ needHelperImport = true ;
12881283 }
12891284
1290- const name = needHelperFn ? replacementName : importName ;
1291-
1292- code = code . replace ( new RegExp ( replacementName , "g" ) , ( ) =>
1293- isTemplateLiteralSupported ? `\${${ name } }` : `" + ${ name } + "` ,
1294- ) ;
1295- } else {
1296- code = code . replace ( new RegExp ( replacementName , "g" ) , ( ) =>
1297- isTemplateLiteralSupported
1298- ? `\${${ replacementName } }`
1299- : `" + ${ replacementName } + "` ,
1300- ) ;
1285+ replacersCode += `var ${ replacementName } = ${ GET_SOURCE_FROM_IMPORT_NAME } (${ importName } ${ preparedOptions } );\n` ;
13011286 }
1287+
1288+ const name = needHelperFn ? replacementName : importName ;
1289+
1290+ code = code . replace ( new RegExp ( replacementName , "g" ) , ( ) =>
1291+ isTemplateLiteralSupported ? `\${${ name } }` : `" + ${ name } + "` ,
1292+ ) ;
13021293 }
13031294
13041295 // Replaces "<script>" or "</script>" to "<" + "script>" or "<" + "/script>".
0 commit comments