-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
tsconfig seems to be ignored #15201
Comments
Hello @JensClasen. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
Start a new pull request in StackBlitz Codeflow. |
Reproduction added. I don't think, that that will really help. since I can't install the dependency on stack blitz. |
I also encounter this problem, which is ok in vite4 |
Any solution to fixed it? |
use it in vite.config |
Try this:
|
Thanks @dev-anton-ko, that fixed the problem. 👍🏻 It's strange that this option is ignored from |
This saved my day after wasting many hours trying to figure out why decorators worked in production but not on one of my dev machines. It turns out that with vite 5+, the tsconfig.json "experimentalDecorators: true" gets ignored. Possibly an esbuild issue? The above settings work but the problem needs to be fixed at the root. This is a patch. |
Describe the bug
Hey all,
I'm trying to use inversifyJS (a DI container) together with vite. inversify heavily depends on decorators, therefor nothing will work, unless experimental decorators are enabled for almost all compilations.
This is my current file layout:
In my one existing tsconfig.json, I have these settings:
The workflow starts as usual in /src/main.tsx:
and it hops from there over to /components/App.tsx:
From there, the DI container config in /inversify.config.tsx is imported:
This is followed by an import for my application contract in /model/contract/IClientApplicationConfig.tsx:
Having done all that, the container should be used to initialize my sample application in /model/ClientApplication.tsx:
To create an instance of my application, the DI container must use constructor property injection and therefor the experimental decorators.
The config implementation in /model/ClientApplicationConfig.tsx is again just a little sample:
According to all the docs, this should work. At least I'd have thought so. Instead, this is what happens:
Especially the last line bothers me since my tsconfig.json does contain the necessary line. It therefor stands to reason, that my tsconfig.json is not found at all.
If I now change my folder structure and place every file in the src directory:
Then the error is gone and npm run dev works without problems.
The behavior smells a bit like #7932. Neither the explanation, nor the workaround seem to fit, though. I'm stepping not out of the project root in my case. I'm working in three of it's subfolders. I would have expected, that the tsconfig should have been found.
I did not manage to get the workaround from #7932 to work. Even if I had managed to do so, a package.json in every folder is no workable solution.
Any ideas?
Regards, Jens
Reproduction
part of the description
Steps to reproduce
No response
System Info
System: OS: Linux 6.4 Arch Linux CPU: (4) x64 Intel(R) Core(TM) i5-7300U CPU @ 2.60GHz Memory: 7.25 GB / 15.50 GB Container: Yes Shell: 3.6.1 - /usr/bin/fish Binaries: Node: 20.5.0 - /usr/bin/node npm: 9.8.1 - /usr/bin/npm npmPackages: vite: ^5.0.0 => 5.0.4
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: