-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Closed
Labels
🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.scope: compiler
Description
Vue version
3.5.13
Link to minimal reproduction
https://github.com/Teages/vue-allow-arbitrary-extensions
Steps to reproduce
- enable allowArbitraryExtensions in
tsconfig.json
- create two files:
WithType.vue
,WithType.d.vue.ts
, add a type export inWithType.d.vue.ts
- try to import the type by
import type { X } from './WithType.vue'
You can run pnpm i & pnpm play
in the reproduction
What is expected?
Vue should load the type from WithType.d.vue.ts
as allowArbitraryExtensions was enable and .vue
file is not a known JavaScript or TypeScript file extension.
What is actually happening?
Vue try to resolve the type from WithType.vue
but not WithType.d.vue.ts
, and finally it doesn't find the type and throw a error:
~/main.ts:80
throw new Error(`[vue-sfc-transformer] ${msg}`);
^
Error: [vue-sfc-transformer] Unresolvable type reference or unsupported built-in utility type
at Object.error (~/main.ts:80:13)
at innerResolveTypeElements (~/node_modules/.pnpm/@vue+compiler-sfc@3.5.13/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:22104:20)
at resolveTypeElements (~/node_modules/.pnpm/@vue+compiler-sfc@3.5.13/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:21995:20)
at resolveRuntimePropsFromType (~/node_modules/.pnpm/@vue+compiler-sfc@3.5.13/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:23632:20)
at extractRuntimeProps (~/node_modules/.pnpm/@vue+compiler-sfc@3.5.13/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:23608:17)
at processDefineProps (~/main.ts:57:57)
at ~/main.ts:24:35
Node.js v22.14.0
System Info
N/A
Any additional comments?
nuxt/module-builder#597
unjs/mkdist#270
unjs/mkdist#268 (comment)
https://github.com/vuejs/core/blob/v3.5.13/packages/compiler-sfc/src/script/resolveType.ts#L1154
I can try to make a pull request to fix it if you want.
sandros94 and linzhe141
Metadata
Metadata
Assignees
Labels
🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.scope: compiler