File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
packages/compiler-sfc/src/script Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -1029,6 +1029,13 @@ function resolveWithTS(
1029
1029
if ( configs . length === 1 ) {
1030
1030
matchedConfig = configs [ 0 ]
1031
1031
} else {
1032
+ const [ major , minor ] = ts . versionMajorMinor . split ( '.' ) . map ( Number )
1033
+ function getPattern ( base : string , p : string ) : string {
1034
+ return p . startsWith ( '${configDir}' ) && major >= 5 && minor >= 5
1035
+ ? // ts 5.5+ supports ${configDir} in paths
1036
+ p . replace ( '${configDir}' , dirname ( configPath ! ) )
1037
+ : joinPaths ( base , p )
1038
+ }
1032
1039
// resolve which config matches the current file
1033
1040
for ( const c of configs ) {
1034
1041
const base = normalizePath (
@@ -1039,11 +1046,11 @@ function resolveWithTS(
1039
1046
const excluded : string [ ] | undefined = c . config . raw ?. exclude
1040
1047
if (
1041
1048
( ! included && ( ! base || containingFile . startsWith ( base ) ) ) ||
1042
- included ?. some ( p => isMatch ( containingFile , joinPaths ( base , p ) ) )
1049
+ included ?. some ( p => isMatch ( containingFile , getPattern ( base , p ) ) )
1043
1050
) {
1044
1051
if (
1045
1052
excluded &&
1046
- excluded . some ( p => isMatch ( containingFile , joinPaths ( base , p ) ) )
1053
+ excluded . some ( p => isMatch ( containingFile , getPattern ( base , p ) ) )
1047
1054
) {
1048
1055
continue
1049
1056
}
You can’t perform that action at this time.
0 commit comments