-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
error: File App.vue is not a module.Because I separated my ts into separate files. #1720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
May be related to #1576 |
@Akryum Little relationship <script lang="ts">
import App from './App'
export default App
</script> |
It could be a problem with
.vue and .(j|t)s are configured to be resolved via webpack without including an extension. Therefor App.(j|t)s and App.vue could be mixed up. |
@ChristianStornowski
|
@sengmitnick the linked reproduction does not contain a typescript project, it's in fact a repository used for another (invalid) bug report before. Can you please share the right repository? |
Heres a link: https://github.com/bobmoff/vue-cli-not-a-module Only change I have made is to move the script content out from HelloWorld.vue into the a new file named HelloWorld.ts and then added src="./HelloWorld" to the script tag in the .vue file. Been struggling with this for 2 days now trying to convert a project from the old webpack templates to the new cool vue-cli scaffolding and not understanding why stuff is so broken. The error I am getting in this example is:
It doesn't seem to matter if i change to or
inside the script tag Any help is appreciated :) Edit: Selected features when creating the project: Babel, Typescript, Router, CSS Pre-processsors |
If I change the name of the .ts file from HelloWorld.ts to HelloWorldCode.ts and use the |
@bobmoff Quote your recurring link directly <script lang="ts">
import App from './App'
export default App
</script> |
why? xxxx.vue' is not a module |
For anyone running into this issue in 2022;
I had to add the 'include' list to my tsconfig.json for nuxt app |
As it appears the script section has to export something <script lang="ts">
export default {}
</script> |
1. Cannot find module '../views/AboutView.vue' or its corresponding type declarations. disable VSCode's built-in TS language service Refer to : https://vuejs.org/guide/typescript/overview.html#volar-takeover-mode 2. Property 'env' does not exist on type 'ImportMeta'. Refer to : https://vitejs.dev/guide/features.html#client-types 3. src/App.vue.ts is not listed within the file list of project tsconfig.vitest.json Refer to : vuejs/vue-cli#1720 (comment)
Lev |
|
Version
3.0.0-rc.3
Reproduction link
https://github.com/bobmoff/vue-cli-not-a-module
Steps to reproduce
yarn build
What is expected?
Successful compilation
What is actually happening?
ERROR in /Users/smk17/VsCode/hello-world/src/main.ts
3:17 File '/Users/smk17/VsCode/hello-world/src/App.vue' is not a module.
I extracted ts to
<script src="./App.ts"></script>App.ts
inApp.vue
and introduced it in the following way:The text was updated successfully, but these errors were encountered: