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

197
Views
How can I make VSCode auto complete paths (parses) if I use '@ => ./src/component' in Vite project

In a Vite project my config file is as follow

import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path';

export default defineConfig({
  plugins: [vue()],

  build: {
    outDir: 'public',
  },

  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src/components'),
      '~': path.resolve(__dirname, './src'),
    },
  },

  envDir: './',
  envPrefix: 'STO_',
});

VSCode doesn't parse paths starting with @ or ~ so if a file doesn't exists I don't even see the error, and I have bad auto-completion experience.

In PhpStorm I think there is a file called phpstorm.config.js where we can tell the editor how to parse such characters.

System.config({
  paths: {
    '@/*': './src/components/*',
    '~/*': './src/*',
  },
});

How can I fix this in VSCode? Is there a similar approach?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

same approach as with a webpack

i configured mytsconfig.json (or alternatively jsconfig.json) to re-map the import statements:

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "~/*": ["./src/*"],
      "@/*": ["./src/components/*"]
    }
  }
}

same answer as https://stackoverflow.com/a/39414291/13278193

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!