File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -21,18 +21,18 @@ export function addRefreshWrapper<M extends { mappings: string }>(
2121 map : M | string | undefined | typeof avoidSourceMapOption ,
2222 pluginName : string ,
2323 id : string ,
24- ) : { code : string ; map : M | undefined | string } {
24+ ) : { code : string ; map : M | null | undefined | string } {
2525 const hasRefresh = refreshContentRE . test ( code )
2626 const onlyReactComp = ! hasRefresh && reactCompRE . test ( code )
27- const newMap =
28- map === avoidSourceMapOption
29- ? undefined
30- : typeof map === 'string'
31- ? ( JSON . parse ( map ) as M )
32- : map
33- if ( ! hasRefresh && ! onlyReactComp ) return { code, map : newMap }
27+ const normalizedMap = map === avoidSourceMapOption ? null : map
28+
29+ if ( ! hasRefresh && ! onlyReactComp ) return { code, map : normalizedMap }
3430
3531 const avoidSourceMap = map === avoidSourceMapOption
32+ const newMap =
33+ typeof normalizedMap === 'string'
34+ ? ( JSON . parse ( normalizedMap ) as M )
35+ : normalizedMap
3636
3737 let newCode = code
3838 if ( hasRefresh ) {
You can’t perform that action at this time.
0 commit comments