Permalink
Browse files

fix: Copy SFCDescriptor before further passing it to processors (#243)

scss processor modifies descriptor.styles[x].map.mappings and
`parse` function from `component-compiler-utils` caches the parsing
result. These two combined would cause a bug when rolling-up
multiple-output configuration since the descriptor is modified and
cached in the first turn and causing successive turns to fail.
  • Loading branch information...
Nandiin authored and znck committed Nov 5, 2018
1 parent 5d8aa49 commit 3c1113b352b1ab3d1263aee966815a46d2186820
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/index.ts
@@ -194,14 +194,14 @@ export default function VuePlugin(opts: VuePluginOptions = {}): Plugin {

async transform(source: string, filename: string) {
if (isVue(filename)) {
const descriptor = parse({
const descriptor: SFCDescriptor = JSON.parse(JSON.stringify(parse({
filename,
source,
compiler: opts.compiler || templateCompiler,
compilerParseOptions: opts.compilerParseOptions,
sourceRoot: opts.sourceRoot,
needMap: true
})
})))

const scopeId =
'data-v-' +

0 comments on commit 3c1113b

Please sign in to comment.