@@ -5,7 +5,6 @@ import getEtag from 'etag'
5
5
import convertSourceMap from 'convert-source-map'
6
6
import type { SourceDescription , SourceMap } from 'rollup'
7
7
import colors from 'picocolors'
8
- import MagicString from 'magic-string'
9
8
import type { ViteDevServer } from '..'
10
9
import {
11
10
blankReplacer ,
@@ -19,8 +18,6 @@ import {
19
18
} from '../utils'
20
19
import { checkPublicFile } from '../plugins/asset'
21
20
import { getDepsOptimizer } from '../optimizer'
22
- import { isCSSRequest } from '../plugins/css'
23
- import { SPECIAL_QUERY_RE } from '../constants'
24
21
import { injectSourcesContent } from './sourcemap'
25
22
import { isFileServingAllowed } from './middlewares/static'
26
23
@@ -257,26 +254,11 @@ async function loadAndTransform(
257
254
isDebug && debugTransform ( `${ timeFrom ( transformStart ) } ${ prettyUrl } ` )
258
255
code = transformResult . code !
259
256
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
- }
271
257
}
272
258
273
259
if ( map && mod . file ) {
274
260
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 ) {
280
262
await injectSourcesContent ( map , mod . file , logger )
281
263
}
282
264
}
0 commit comments