File tree 1 file changed +5
-12
lines changed
packages/vite/src/node/plugins
1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -403,18 +403,11 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin {
403
403
if ( code . indexOf ( isModernFlag ) > - 1 ) {
404
404
const re = new RegExp ( isModernFlag , 'g' )
405
405
const isModern = String ( format === 'es' )
406
- if ( this . environment . config . build . sourcemap ) {
407
- const s = new MagicString ( code )
408
- let match : RegExpExecArray | null
409
- while ( ( match = re . exec ( code ) ) ) {
410
- s . update ( match . index , match . index + isModernFlag . length , isModern )
411
- }
412
- return {
413
- code : s . toString ( ) ,
414
- map : s . generateMap ( { hires : 'boundary' } ) ,
415
- }
416
- } else {
417
- return code . replace ( re , isModern )
406
+ const isModernWithPadding =
407
+ isModern + ' ' . repeat ( isModernFlag . length - isModern . length )
408
+ return {
409
+ code : code . replace ( re , isModernWithPadding ) ,
410
+ map : null ,
418
411
}
419
412
}
420
413
return null
You can’t perform that action at this time.
0 commit comments