Skip to content

Commit

Permalink
fix: correctly shim @vue/compiler-sfc for fork-ts-checker-plugin (#5539)
Browse files Browse the repository at this point in the history
Fixes the line padding to retain diagnostics location
  • Loading branch information
sodatea committed Jun 2, 2020
1 parent 36f961e commit b9b2fcd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/@vue/cli-plugin-typescript/vue-compiler-sfc-shim.js
Expand Up @@ -2,6 +2,13 @@ const compilerSFC = require('@vue/compiler-sfc')

module.exports = {
parseComponent (content, options) {
return compilerSFC.parse(content, options)
const result = compilerSFC.parse(content, options)
const { script } = result.descriptor

// fork-ts-checker-webpack-plugin needs to use the `start` property,
// which doesn't present in the `@vue/compiler-sfc` parse result
if (script) {
script.start = script.loc.start.offset
}
}
}

0 comments on commit b9b2fcd

Please sign in to comment.