Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

393
Views
Is VSCode Intellisense unable to autocomplete absolute imports using webpack aliases?

I have a Gatsby project, and I'm trying to eliminate complicated relative imports. Setting up aliases for absolute imports worked perfectly, I am using gatsby-plugin-alias-imports & eslint-plugin-import so that these aliased paths resolve during build and within eslint without any errors.

gatsby-config.js:

...
{
    resolve: 'gatsby-plugin-alias-imports',
    options: {
        alias: {
            '@components': 'src/components',
        },
        extensions: ['.js', '.jsx', '.json'],
    },
},

and eslintrc.js:

...
settings: {
    react: {
        version: 'detect',
    },
    'import/resolver': {
        alias: {
            map: [
                ['@components', './src/components'],
            ],
            extensions: ['.js', '.jsx', '.json'],
        },
    },
},

But VScode won't autocomplete these paths while I'm trying to type a new import. I found this and set up a jsconfig, but it made no difference: https://code.visualstudio.com/docs/languages/jsconfig#_using-webpack-aliases

jsconfig.json

"compilerOptions": {
    "module": "commonjs",
    "target": "es6",
    "baseUrl": ".",
    "paths": {
        "@components/*": ["/src/components"],
    }
},

I've tried several difference variations on the paths setup in jsconfig which I've seen on other questions, but none of them make a difference. I'd like to be able to get an autocomplete popup when I start typing, for example,

import Button from '@components/common/Button'

but I get nothing. Is this just not possible?

ps. changes I've tried in jsconfig.json:

  • baseUrl: "." -> "./"
  • paths (key): "@components", "@components/", "@components/*", "*"
  • paths (value): ["src/components/"], ["src/components/*"], ["src/*"]
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Solved: You can't have a tsconfig and jsconfig in the same repo.

We accidentally had a tsconfig in the non-ts project, and this caused VSCode to ignore jsconfig entirely.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!