@@ -5,7 +5,6 @@ import getEtag from 'etag'
55import convertSourceMap from 'convert-source-map'
66import type { SourceDescription , SourceMap } from 'rollup'
77import colors from 'picocolors'
8- import MagicString from 'magic-string'
98import type { ViteDevServer } from '..'
109import {
1110 blankReplacer ,
@@ -19,8 +18,6 @@ import {
1918} from '../utils'
2019import { checkPublicFile } from '../plugins/asset'
2120import { getDepsOptimizer } from '../optimizer'
22- import { isCSSRequest } from '../plugins/css'
23- import { SPECIAL_QUERY_RE } from '../constants'
2421import { injectSourcesContent } from './sourcemap'
2522import { isFileServingAllowed } from './middlewares/static'
2623
@@ -257,26 +254,11 @@ async function loadAndTransform(
257254 isDebug && debugTransform ( `${ timeFrom ( transformStart ) } ${ prettyUrl } ` )
258255 code = transformResult . code !
259256 map = transformResult . map
260-
261- // To enable IDE debugging, add a minimal sourcemap for modified JS files without one
262- if (
263- ! map &&
264- mod . file &&
265- mod . type === 'js' &&
266- code !== originalCode &&
267- ! ( isCSSRequest ( id ) && ! SPECIAL_QUERY_RE . test ( id ) ) // skip CSS : #9914
268- ) {
269- map = new MagicString ( code ) . generateMap ( { source : mod . file } )
270- }
271257 }
272258
273259 if ( map && mod . file ) {
274260 map = ( typeof map === 'string' ? JSON . parse ( map ) : map ) as SourceMap
275- if (
276- map . mappings &&
277- ( ! map . sourcesContent ||
278- ( map . sourcesContent as Array < string | null > ) . includes ( null ) )
279- ) {
261+ if ( map . mappings && ! map . sourcesContent ) {
280262 await injectSourcesContent ( map , mod . file , logger )
281263 }
282264 }
0 commit comments