Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit 4ec1315

Browse files
piougznck
andauthored
fix: avoid conflicting filename for sourcemaps (#375)
Co-authored-by: Rahul Kadyan <hi@znck.me>
1 parent cd41410 commit 4ec1315

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/index.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export default function PluginVue(userOptions: Partial<Options> = {}): Plugin {
127127
if (block) {
128128
return {
129129
code: block.content,
130-
map: normalizeSourceMap(block.map),
130+
map: normalizeSourceMap(block.map, id),
131131
}
132132
}
133133
}
@@ -196,7 +196,7 @@ export default function PluginVue(userOptions: Partial<Options> = {}): Plugin {
196196

197197
return {
198198
code: result.code,
199-
map: normalizeSourceMap(result.map!),
199+
map: normalizeSourceMap(result.map!, id),
200200
}
201201
} else if (query.type === 'style') {
202202
debug(`transform(${id})`)
@@ -263,7 +263,7 @@ export default function PluginVue(userOptions: Partial<Options> = {}): Plugin {
263263
} else {
264264
return {
265265
code: result.code,
266-
map: normalizeSourceMap(result.map!),
266+
map: normalizeSourceMap(result.map!, id),
267267
}
268268
}
269269
}
@@ -638,9 +638,14 @@ function _(any: any) {
638638
return JSON.stringify(any)
639639
}
640640

641-
function normalizeSourceMap(map: SFCTemplateCompileResults['map']): any {
641+
function normalizeSourceMap(map: SFCTemplateCompileResults['map'], id: string): any {
642642
if (!map) return null as any
643643

644+
if (!id.includes('type=script')) {
645+
map.file = id;
646+
map.sources[0] = id;
647+
}
648+
644649
return {
645650
...map,
646651
version: Number(map.version),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy