Closed aleclarson closed 7 months ago
Released in v3.5.0
How does this work ? My project use this and it not working as intended :(
@huyhoang160593 What plugin version are you using? Might be a regression in v4
I can confirm it's a v4 regression. We're using tsconfck
now to find tsconfig files, and it doesn't support jsconfig files yet. @dominikg said that a PR would be welcome.
/cc @MichaelDeBoey you might be interested in adding this to tsconfck
? no worries if you don't :)
@aleclarson I currently don't have the bandwidth to look into that unfortunately
@aleclarson the thing is that I'm using the version 3.2.5 of vite :(. After debug only the tsconfig.json is load. But even with tsconfig load the path still not working :(. Was using Window 11 is one of the source of the problem :((((
It is pity that there is a regression on that. @huyhoang160593 it was working on windows 11 as well for me at least in version 3.6.0 in this exemplary project https://github.com/ibqn/beni-15-puzzle
"vite-tsconfig-paths": "^3.6.0"
It is pity that there is a regression on that. @huyhoang160593 it was working on windows 11 as well for me at least in version 3.6.0 in this exemplary project https://github.com/ibqn/beni-15-puzzle
"vite-tsconfig-paths": "^3.6.0"
It seem like in your jsconfig.json
there is no "path" been defined? This plugin is basically doing nothing with your project for now
@huyhoang160593 I use it for global importing i.e. for example
import { App } from 'app'
import 'index.css'
Hello hello! Is there a chance to get the jsconfig.json
support back? Maybe using cosmiconfig
is possible? For now I got to convert the file to tsconfig.json
and add some attributes. (I'm migrating from react-scripts to vite)
{
"compilerOptions": {
"allowJs": true,
"noEmit": true,
"baseUrl": "src",
"jsx": "react"
},
"include": ["src"]
}
Leaving it here maybe someone needs something similar. allowJs
and noEmit
make it equivalent from react-scripts' jscofig.json
UPDATE: NVM just realized `tsconfck already supports jsconfig.json since version 3. https://github.com/dominikg/tsconfck/pull/132 Any chance to get that version bump?
@diego-hourly It's not simply a version bump. Since we use tsconfck
for file discovery and it doesn't support searching for both tsconfig.json
and jsconfig.json
at the same time, we'll have to settle for either double-crawling or a new option that lets you (the plugin user) override the default configName
with "jsconfig.json"
in your Vite config (which means, tsconfig.json
files wouldn't be used). At first glance, the double-crawling approach seems the best DX with a hopefully negligible performance hit. Nowhere in the near future will I have time to investigate whether double-crawling is a viable solution or not, so it's up to the community.
tsconfck 3 with its new async cache is a lot faster (60-100 times faster!) than tsconfck 2. So even with a double crawl it would be an improvement. But either way in regular projects users won't notice, there are just not enough files/directories for it to make a difference.
The real question is what you would do with the result of a double crawl. Typescript itself uses tsconfig.json by default and you can tell it about jsconfig.json with a cli flag. To my knowledge, its not defined how precedence is handled in a scenario where there are mixed jsconfig.json and tsconfig.json files, so the easy solution here is to follow typescripts lead and make the config name configurable. If you allow both simultaneously, it would be your responsibility to check which one is closer to the input file, tsconfck does not offer a hybrid mode (and has no plans to, unless typescript itself made that move)
Support for jsconfig.json
released in v4.3.0
Thank you! @aleclarson
For now, you can use a
tsconfig.json
in your js only project.all
jsconfig.json
really does (for vs code, at least) is implicitly setallowJs: true
and disable errors relating to actual typescript compilation.I've found the following
tsconfig.json
to work fine to enable this plugin in a js only project: