Skip to content

Commit b9b2fcd

Browse files
authored
fix: correctly shim @vue/compiler-sfc for fork-ts-checker-plugin (#5539)
Fixes the line padding to retain diagnostics location
1 parent 36f961e commit b9b2fcd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/@vue/cli-plugin-typescript/vue-compiler-sfc-shim.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ const compilerSFC = require('@vue/compiler-sfc')
22

33
module.exports = {
44
parseComponent (content, options) {
5-
return compilerSFC.parse(content, options)
5+
const result = compilerSFC.parse(content, options)
6+
const { script } = result.descriptor
7+
8+
// fork-ts-checker-webpack-plugin needs to use the `start` property,
9+
// which doesn't present in the `@vue/compiler-sfc` parse result
10+
if (script) {
11+
script.start = script.loc.start.offset
12+
}
613
}
714
}

0 commit comments

Comments
 (0)