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

React files are not parsed when using Yarn workspaces #391

Closed
henrikbjorn opened this issue Jun 13, 2020 · 3 comments
Closed

React files are not parsed when using Yarn workspaces #391

henrikbjorn opened this issue Jun 13, 2020 · 3 comments

Comments

@henrikbjorn
Copy link

Describe the bug

We use Yarn workspaces internally in our React applications to make imports shorter and to make a clearer seperation between business logic and packages that could be separate.

Setting this up with Vite and using optimizeDeps.links seems to work for the most part.

However when we change the import in main.tsx for the <App /> component to import App from '@app/test/App' then vite won't recognize it is an React component.

[vite] failed to parse /@modules/@app/test/App.tsx for import rewrite.
web_1  | If you are using JSX, make sure to named the file with the .jsx extension.

However it will find the file just fine.

Reproduction

https://github.com/henrikbjorn/vite-workspaces-issue

System Info

  • required vite version: 0.20.8
  • required Operating System: Docker Alpine
  • required Node version: 14.x.x
@henrikbjorn
Copy link
Author

When building it can't find the module @app/test/App but using @app/test/App.tsx (and ignoring the ts error with @ts-ignore) then it works.

@dsseng
Copy link

dsseng commented Jun 14, 2020

Do .ts and .jsx files work correctly?

@henrikbjorn
Copy link
Author

Do .ts and .jsx files work correctly?

Nope.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
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

2 participants