Skip to content
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

Vue: TS2307 "Cannot find module './app/App.vue'" #26543

Closed
1 of 4 tasks
fabiog27 opened this issue Jun 13, 2024 · 3 comments
Closed
1 of 4 tasks

Vue: TS2307 "Cannot find module './app/App.vue'" #26543

fabiog27 opened this issue Jun 13, 2024 · 3 comments

Comments

@fabiog27
Copy link

fabiog27 commented Jun 13, 2024

Current Behavior

In a monorepository with @nx/vue, opening the file apps/app-name/src/main.ts, there is a TS2307 error on the import of App.vue.

Expected Behavior

The import should be recognized correctly.

GitHub Repo

https://github.com/fabiog27/nx-dev-vue-ts-error

Steps to Reproduce

  1. Clone the provided repository
  2. Open the monorepository in IntelliJ (tested in 2024.1.3) or VS Code (tested in 1.90.0)
  3. Run a npm install
  4. Open the file apps/demo/src/main.ts

Nx Report

Node   : 20.11.0
OS     : darwin-arm64
npm    : 10.2.4

nx                 : 19.2.3
@nx/js             : 19.2.3
@nx/linter         : 19.2.3
@nx/eslint         : 19.2.3
@nx/workspace      : 19.2.3
@nx/cypress        : 19.2.3
@nx/devkit         : 19.2.3
@nx/eslint-plugin  : 19.2.3
@nrwl/tao          : 19.2.3
@nx/vite           : 19.2.3
@nx/vue            : 19.2.3
@nx/web            : 19.2.3
typescript         : 5.4.5
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/vite/plugin
@nx/cypress/plugin

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

I think it has to do with the language server that is picked for the file. In a standalone Vue project, it is the vue language server that is used even for the .ts files. In a monorepository, the TypeScript language server is used and the vue server is only used on .vue files.

On IntelliJ this can be forced with a .ws-context file in the workspace root with the following content:

{
  "framework": "typescript",
  "apps/demo/**": {
    "framework": "vue"
  }
}

However, this is cumbersome, and only works in IntelliJ.

@Coly010
Copy link
Contributor

Coly010 commented Jun 28, 2024

Hey :) I'm unable to reproduce this error 🤔

Can you make sure you restart your TS server on vscode to see if you stil encounter it?

Copy link

github-actions bot commented Jul 6, 2024

This issue has been automatically marked as stale because more information has not been provided within 7 days.
It will be closed in 21 days if no information is provided.
If information has been provided, please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@github-actions github-actions bot added the stale label Jul 6, 2024
@Coly010 Coly010 closed this as completed Jul 18, 2024
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants