FranckFreiburger / vue3-sfc-loader

Single File Component loader for Vue2 and Vue3. Load .vue files directly from your HTML. No node.js environment, no build step.
MIT License
1.03k stars 116 forks source link

loadModule import breaks in production build in Vite + Vue3 + TS #152

Open isaeedahmed opened 1 year ago

isaeedahmed commented 1 year ago

Describe the bug While trying to import loadModule as show below:

import { loadModule } from "../node_modules/vue3-sfc-loader/dist/vue3-sfc-loader.esm.js"

TS starts complaining and the following error is thrown while building the application:

Could not find a declaration file for module '../node_modules/vue3-sfc-loader/dist/vue3-sfc-loader.esm.js'. 'c:/Users/xxx/Desktop/project_folder/project_title/node_modules/vue3-sfc-loader/dist/vue3-sfc-loader.esm.js' implicitly has an 'any' type.

To Reproduce

Just try to import as above and the error should be reproduced. One question would be that am I importing it wrong? As far as I can see in examples it was supposed to be imported like this.

Versions

lukemovement commented 1 month ago

Try using import { loadModule } from "vue3-sfc-loader";.