Update import/require paths when a file is moved or renamed - not working Update import/require paths when a file is moved or renamed - not working linux linux

Update import/require paths when a file is moved or renamed - not working


So, you need to have a jsconfig.json file in the root path, to make sure all paths work.


I tried to recreate your problem with the current version of Visual Studio Code (1.44) but I did not stumble on any problems: In File/Preferences/Settings I set the prompt-option for updating imports see image:

Then I created an "app"-folder with the following files see image:

app/appLogic.js

import GLOBAL_VARS from './GLOBAL_VARS/GLOBAL_VARS.js'console.debug(GLOBAL_VARS.laugh())

app/package.json

{"type":"module"}

app/GLOBAL_VARS/GLOBAL_VARS.js

var LAUGH = "haha"export default {    laugh(){        return LAUGH    }}

I then moved the JS file "GLOBAL_VARS.js" to a different folder and VS Code suggested automatic imports update with a prompt, just as set in the preferences before see image:


Make sure you opened the right folder in VScode - eg if your project structure is like below -

project/node_modules/src --A.js --B.js/build/configpackage.jsonjsconfig.json

You open folder project in VScode and not 'src' folder.For some reasons VSCode is unable to detect import changes if you do not open the complete project folder in explorer.

Try open complete project in explorer