Closed lanthaler closed 3 years ago
What version of Vite are you using?
Last I checked, this plugin works fine with .vue
SFC files. See the demo branch.
I tested it with Vite 2.0.4. It doesn't work when I use aliases in the template part of a SFC. I get errors such as
[vite] Internal server error: Failed to resolve import "@assets/symbols.svg". Does the file exist?
I'm not familiar with Vue. Can you fork the demo branch, reproduce the issue, and share it here so I can debug it?
Here are the necessary changes to reproduce the issue on the vue demo branch: https://github.com/lanthaler/vite-tsconfig-paths/commit/3d260254bfa3824eda1c53df97cee7821c786b22
I am experiencing the same problem:
typescript: 4.1.3 vite: 2.0.5
> src/main.ts:5:16: error: No loader is configured for ".vue" files: src/App.vue
5 │ import App from '~/App.vue';
@dipasqualew That seems unrelated. Open a new issue with a repro, thanks!
@lanthaler Ah ok, that's not within a <script lang="ts">
block, so it's unsupported. But it's a good argument for merging this PR. :)
Released in v2.5.0
I spent quite a while wondering why my tsconfig paths didn't work in .vue SFC files till I found this code which ignores all the config for all files but TS/JS source files. This option addresses it by applying the paths globally just as setting them up in
resolve.alias
invite.config.ts
would.