Subwaytime / vite-aliases

Alias auto generation for Vite
https://www.npmjs.com/package/vite-aliases
MIT License
213 stars 13 forks source link

Cannot find module #53

Closed ga676005 closed 1 year ago

ga676005 commented 1 year ago

Hello,

I follow the installation guide and there is an error Cannot find module '@HelloWorld.vue' or its corresponding type declarations.

image

Is there any extra config needed in order to make this work?

Thank you

ga676005 commented 1 year ago

After reading more document, I need to set these two options to true for TypeScript.

ViteAliases({
    /**
     * Generates paths in IDE config file
     * works with JS or TS
     * for Typescript: set `useTypescript` true
     */
    useConfig: true,

    /**
     * Will generate Paths in tsconfig
     * used in combination with `useConfig`
     */
    useTypescript: true,
})