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

Support jsconfig.json #22

Open
aleclarson opened this issue Apr 22, 2021 · 11 comments
Open

Support jsconfig.json #22

aleclarson opened this issue Apr 22, 2021 · 11 comments
Labels
enhancement New feature or request

Comments

@aleclarson
Copy link
Owner

No description provided.

@aleclarson aleclarson added the enhancement New feature or request label Apr 22, 2021
@beforan
Copy link

beforan commented Nov 22, 2021

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 set allowJs: 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:

{
  "compilerOptions": {
    // this is implicitly set in a `jsconfig.json` so we have to do it manually here
    "allowJs": true,

    "outDir": "dist", // this essentially disables the compilation errors by telling vs code where files would be put if it were to compile (which it won't because this isn't a real typescript project)

    // Do these as normal to your liking for your project
    "baseUrl": "src",
    "paths": {
      "*": ["src/*"]
    }
  },

  // only treat files in here as js source (thus ignoring `node_modules` and your fake output directory above)
  "include": ["src"]
}

@aleclarson
Copy link
Owner Author

Released in v3.5.0

@huyhoang160593
Copy link

How does this work ? My project use this and it not working as intended :(

@aleclarson
Copy link
Owner Author

@huyhoang160593 What plugin version are you using? Might be a regression in v4

@aleclarson
Copy link
Owner Author

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.

https://github.com/dominikg/tsconfck

@aleclarson aleclarson reopened this Dec 8, 2022
@aleclarson
Copy link
Owner Author

/cc @MichaelDeBoey you might be interested in adding this to tsconfck? no worries if you don't :)

@MichaelDeBoey
Copy link
Contributor

@aleclarson I currently don't have the bandwidth to look into that unfortunately

@huyhoang160593
Copy link

@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 :((((

@ibqn
Copy link

ibqn commented Dec 12, 2022

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"

@huyhoang160593
Copy link

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

@ibqn
Copy link

ibqn commented Dec 13, 2022

@huyhoang160593 I use it for global importing i.e. for example

import { App } from 'app'
import 'index.css'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants