0

This is probably a pretty basic question, but I can't find an answer:

If I have a project with a dependency in package.json listed as foobar: ^3.2.1, what version of that dependency will be installed when I run vite build, assuming that the latest available version of the package is 3.4.5?

Zach M.
  • 74
  • 8
  • 1
    You can check semver to understand the various ranges: https://semver.org/ Otherwise, depending of your package manager, you could run the param `list` (or alike) to know the exact version you're using. – kissu Oct 13 '22 at 20:23
  • Give a try to that one: https://stackoverflow.com/a/25497068/8816585 – kissu Oct 13 '22 at 20:29
  • @kissu About the ```list``` param. If I run that command and it shows, say, ```3.3.3``` (somewhere between the version listed in ```package.json``` and the latest release), is that the version of that package that my project will build with? – Zach M. Oct 13 '22 at 20:31
  • Yes, you can use that tool to upgrade them and see which one you do have at the same time: https://www.npmjs.com/package/npm-check-updates – kissu Oct 13 '22 at 21:11

1 Answers1

0

First thing first, vite build won't change anything to your dependencies. I won't install ones nor update them. It will only build your project (i.e. compile / transpile / minify / bundle etc.) using your source code and the code it imports (likely within the node_modules).

It will build locally, so using your local dependencies in the node_modules folder.


To check the current package version you have installed, you can run:

npm list --depth=0 | grep foobar

(The grep part is optional)

You can also open your package-lock.json or yarn.lock file and search for your package to know to what version your package has been fixed to.

To understand about the semantic version with npm, read this documentation: https://docs.npmjs.com/about-semantic-versioning

Kapcash
  • 6,377
  • 2
  • 18
  • 40