From 495e2f7dee96541b71fa02e37761a2fec4b2abfa Mon Sep 17 00:00:00 2001 From: Gilles Piou Date: Thu, 23 Jul 2020 01:01:22 +0800 Subject: [PATCH] Fix conflicting filename for sourcemaps --- src/index.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index c819a6b..f370ede 100644 --- a/src/index.ts +++ b/src/index.ts @@ -123,7 +123,7 @@ export default function PluginVue(userOptions: Partial = {}): Plugin { if (block) { return { code: block.content, - map: normalizeSourceMap(block.map), + map: normalizeSourceMap(block.map, id), } } } @@ -182,7 +182,7 @@ export default function PluginVue(userOptions: Partial = {}): Plugin { return { code: result.code, - map: normalizeSourceMap(result.map!), + map: normalizeSourceMap(result.map!, id), } } else if (query.type === 'style') { debug(`transform(${id})`) @@ -249,7 +249,7 @@ export default function PluginVue(userOptions: Partial = {}): Plugin { } else { return { code: result.code, - map: normalizeSourceMap(result.map!), + map: normalizeSourceMap(result.map!, id), } } } @@ -621,9 +621,14 @@ function _(any: any) { return JSON.stringify(any) } -function normalizeSourceMap(map: SFCTemplateCompileResults['map']): any { +function normalizeSourceMap(map: SFCTemplateCompileResults['map'], id: string): any { if (!map) return null as any + if (!id.includes('type=script')) { + map.file = id; + map.sources[0] = id; + } + return { ...map, version: Number(map.version), 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