Search code examples
vaadinvaadin24

Should I commit package-lock.json to version control in a Vaadin project?


After upgrading a project to the latest Vaadin 24 version, I removed package-lock.json so that it is regenerated during the build. It wasn't, although the build was successfull and I could run the project without issues.

Has something changed regarding the persistence of npm-related files in Vaadin? In general, should I keep package.json, package-lock.json, and possible other generated files in my code repository of a Vaadin project, or Vaadin will take care of generating them every time? I remember previously the answer was to keep package-lock.json in version control, although it was generated.

Many thanks


Solution

  • If you have a package-lock.json, commit it, along with package.json. Regenerating the files every time will lead to potentially inconsistent builds (not to mention slowness). If you're using the pre-compiled frontend bundle, you might not need the package configuration files at all.