compiler-sfc failed to resolve external type imports under subdirectory
Vue version
3.3.4
Link to minimal reproduction
Steps to reproduce
run
$ npm run dev
It works well.
then run
$ npm run dev:src
It fails with
Error: [@vue/compiler-sfc] Failed to resolve import source "./types2".
anonymous.vue
6 | import type { Props } from './types2';
7 |
8 | defineProps<Props>();
| ^^^^^
9 | </script>
10 |
at async ESMLoader.import (https://stackblitzstarters5bbywb-abfr.w-corp.staticblitz.com/blitz.bec01ace.js:35:1347715)
at async i.loadESM (https://stackblitzstarters5bbywb-abfr.w-corp.staticblitz.com/blitz.bec01ace.js:35:352602)
at async handleMainPromise (https://stackblitzstarters5bbywb-abfr.w-corp.staticblitz.com/blitz.bec01ace.js:35:1051734)
Failed running './src/index.ts'
What is expected?
compileScript
should compile external relative type imports.
What is actually happening?
compile failed
System Info
System:
OS: macOS 13.5
CPU: (8) arm64 Apple M2
Memory: 53.84 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm
pnpm: 8.6.2 - ~/.nvm/versions/node/v18.15.0/bin/pnpm
Browsers:
Chrome: 114.0.5735.248
Safari: 16.6
Any additional comments?
Seems that const filename = joinPaths(scope.filename, '..', source) filename here lacks of relative path.
duplicate of https://github.com/vuejs/core/issues/8775 It will be fixed via https://github.com/vuejs/core/pull/8671/files, But https://github.com/vuejs/core/issues/8775 describes that it only happens on Windows, Could you test if #8775 will fix your problem as well?