Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

153
Visualizações
How i can fix js import auto-hide problem in vs code

Firstly, I imported something from another module in js:

import cloneDeep  from './node_modules/lodash-es/cloneDeep.js'

But when I am not using this cloneDeep in my code and save my script file, then VS Code automatically hides that line.

Before Save

Before Save

After Save

After Save

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

vcode settings.json

{
  "editor.codeActionsOnSave": {
    "source.organizeImports": false
  },
}
about 4 years ago · Juan Pablo Isaza Relatório

0

try instead of import cloneDeep from './node_modules/lodash-es/cloneDeep.js

this: import cloneDeep from 'lodash-es/cloneDeep.js

you don't need to specify node_modules absolute path and if it's es6 import you need to add an entry in package.json:

"type": "module"

are you running it in NodeJs?

edit: if the code editor deleting it then it must be from a linter/extension causing it. Probably because you set the variable as global. either check the extension config or disable it or wrap the variable declaration in a function

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda