File tree Expand file tree Collapse file tree 1 file changed +5
-12
lines changed
packages/vite/src/node/plugins Expand file tree Collapse file tree 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 {
403403 if ( code . indexOf ( isModernFlag ) > - 1 ) {
404404 const re = new RegExp ( isModernFlag , 'g' )
405405 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 ,
418411 }
419412 }
420413 return null
You can’t perform that action at this time.
0 commit comments