This content originally appeared on Bits and Pieces - Medium and was authored by Kevin Vogel
There is a lot of confusion going around when it comes to the difference between tilde and caret inside your package.json file, which can end up in a mess on the production side since you might update accidentally to the version of a dependency that you did not test for production.
In today’s article, I wanna clarify the differences between these two concepts.
~version (approximately equivalent to version)
Will update you on all future patch versions, without incrementing the minor version. ~1.2.3 will use releases from 1.2.3 to <1.3.0.
^version (compatible with version)
Will update you on all future minor/patch versions, without incrementing the major version. ^2.3.4 will use releases from 2.3.4 to <3.0.0.
Thanks for reading my short article about this topic. I hope, I could refresh your knowledge.
Cheers
Use any component in all your projects
Up until now, you used to build features hidden inside larger projects.
But what if you were to develop independent features first, and then easily compose and manage them in many applications? Your development will become faster, more consistent, and more scalable every day. Create a component once, and truly use it anywhere to build anything.
OSS Tools like Bit offer a powerful developer experience for building independent components and composing them to applications. You can start small with a nice project, some shared components, or even trying out Micro Frontends. Give it a try →
Learn more
- Building a React Component Library — The Right Way
- 7 Tools for Faster Frontend Development in 2022
- Microservices are Dead — Long Live Miniservices
Difference between tilde (~) and caret (^) in package.json was originally published in Bits and Pieces on Medium, where people are continuing the conversation by highlighting and responding to this story.
This content originally appeared on Bits and Pieces - Medium and was authored by Kevin Vogel
Kevin Vogel | Sciencx (2022-02-18T07:59:03+00:00) Difference between tilde (~) and caret (^) in package.json. Retrieved from https://www.scien.cx/2022/02/18/difference-between-tilde-and-caret-in-package-json/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.