Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Can't import Hello.vue component #71

Open
brunocasarotti opened this issue Feb 16, 2019 · 1 comment
Open

Can't import Hello.vue component #71

brunocasarotti opened this issue Feb 16, 2019 · 1 comment

Comments

@brunocasarotti
Copy link

I'm trying to to run npm run build and I am getting this error

ERROR in ./src/components/Hello.vue (./node_modules/ts-loader!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/components/Hello.vue)
Module not found: Error: Can't resolve './components/Hello.vue' in 'D:\Projects\typescript-vue-tutorial\src\components'  @ ./src/components/Hello.vue (./node_modules/ts-loader!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/components/Hello.vue) 2:0-52 10:24-38
 @ ./src/components/Hello.vue
 @ ./src/index.ts

ERROR in D:\Projects\typescript-vue-tutorial\src\index.ts
[tsl] ERROR in D:\Projects\typescript-vue-tutorial\src\index.ts(2,28)
      TS2307: Cannot find module './components/Hello.vue'.

image

I can't figure it out. I am already using "vue-loader": "^14.2.2"

@brunocasarotti brunocasarotti changed the title Can't import Hello.vue Can't import Hello.vue component Feb 16, 2019
@HugoWang3146
Copy link

Putting the following vue-shim.d.ts declaration file under my ./src directory solves the problem:

declare module "*.vue" {
    import Vue from "vue";
    export default Vue;
}

A solution from vuejs/vue-cli#1198

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants