Have you ever looked at your package.json file and wondered what the symbols in front of those version numbers mean? Well, you’re in luck because that is exactly what we will be looking at today.
First of all, semantic versioning or semver is a widely adopted standard for versioning software packages. It usually follows the format, MAJOR.MINOR.PATCH where:
- MAJOR: Stands for an update that is backward incompatible.
- MINOR: A backward-compatible new feature has been added.
- PATCH: A backward-compatible bug fix.
With that said, let’s look at what the symbols in front of the version numbers mean in your package.json file.
1) With a leading caret(^) symbol e.g ^2.10.3
This means any MINOR or PATCH version of a dependency can work but it must be within the same MAJOR version.
2) With a leading tilde(~) symbol e.g ~2.10.3
It means any PATCH version will work but it must be within the same MAJOR and MINOR version.
3) With no symbol in front e.g 2.10.3
This means it can only work with the exact version number of that dependency.
And this is all I have for you today, I hope you will go back with something new in your repository of knowledge.
See you in the next one 😉.