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

256
Visualizações
Is it a good practice to use in package.json '*' instead of a certain version of library of '~', '^'?

I passed one learning course on Node.js and Angular. And the teacher there used in package.json

A lot of asterisks instead of specific versions of libs.

"dependencies": {
    "bcrypt": "*",
    "bcryptjs": "^2.4.3",
    "body-parser": "*",
    "cors": "*",
    "express": "*",
    "jsonwebtoken": "*",
    "mongoose": "*",
    "morgan": "^1.10.0",
    "passport": "*",
    "passport-jwt": "*"
  },
  "devDependencies": {
    "nodemon": "^2.0.7"
  }

Is it a good or a bad practice to use them?

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

0

Wildcard is a bad idea. It says load the latest version no matter what. Sounds like a good idea so you do not have to keep updating. It is great until they introduce breaking changes into the api.

If they update from v1.5 to v2.0 and they changed their api, your code that relies on 1.5 syntax will no longer work in v2.0 if it is not backwards compatible. Do this with multiple packages and you have a huge mess on your hands.

Some people will allow the minor version to be wildcard, but most people lock it down and manually upgrade so it can be fully tested.

https://docs.npmjs.com/about-semantic-versioning

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