Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode Intellisense does not work with webpack + alias

I have a project using babel alias:

resolve: {   alias: {       vue: 'vue/dist/vue.js',       '@cmp': resolve('src/components'),       '@service': resolve('src/services'),       '@scss': resolve('src/assets/styles'),   } } 

and a component with:

import someService from '@service/some' 

And the Intellisense does not work. with:

import someService from '../../../../service/some' 

It does.

Any suggestions?

like image 926
Chen Avatar asked Nov 08 '17 13:11

Chen


People also ask

Why is IntelliSense not working in VS Code?

If IntelliSense is not working as it should on your Windows 11/10 PC, you can try restarting VS Code and this should solve the issue. Restarting the program can be really effective and time saving in some cases. If the issue persists, you can try restarting your computer altogether.

How do I turn on VS in IntelliSense?

You can enable or disable particular IntelliSense features in the Options dialog box, under Text Editor > C/C++ > Advanced.

How do I restart IntelliSense VS Code?

Open the Command Palette (Ctrl+Shift+P) and choose the C/C++: Reset IntelliSense Database command.

How do I enable autocomplete VS Code in HTML?

If HTML tags autocompleting issue is on JavaScript files, then you just need to change "select language mode" from "JavaScript" to "JavaScript React". Show activity on this post. Press Ctrl + Shift + P to open the command.


1 Answers

Try creating a jsconfig.json and configuring the paths compiler options

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

You can find more information about paths and other compiler options here

like image 199
Matt Bierner Avatar answered Oct 19 '22 07:10

Matt Bierner