Generate package.json and package-lock.json in Vaadin 24.1.2+

Hey I’m currently running into a weird issue when building my project.
In my current project we recently upgraded to Vaadin 24.1.2 so after upgrading I went through the usual motions → mvn vaadin:clean-frontend to remove node_modules, ...
I also removed package.json and ran a quick mvn clean install -P production, this normally regenerates all the usual “generated” vaadin/npm files. But this time I notice all the files/folders get created but also deleted somewhere during the vaadin-build-frontend step.
I noticed this commit in the flow-maven-plugin: and
Since it says this in the code:

     * The targeted frontend files are files that do not exist when
     * build-frontend target is executed.

Might this be the cause? Is this intentional? How can I regenerate my package.json file?

Your setup might be so simple that those aren’t needed anymore and you can fully use the development bundle - from which version have you updated?

Not sure exactly we have been following the release cadence of Vaadin very closely.

So this behaviour got introduced quite recently

And yes we need these files we import multiple npm packages in our code and have multiple custom lit components

Well then those are really needed :grimacing: what version was your version beforehand?

We very recently upgraded from Vaadin 23 to 24 and have been following the patch releases for 24 quite closely.

The bump to 24.1 was quite recent, so maybe something got changed there

(see the commits I originally linked)

If you run your local development pipeline and e.g. run prepare frontend - are those files generated again?

IIRC if the files are generating during the build, they are removed once the dev or production bundle is created

If they exist prior to run the build they are preserved

Yes that’s the behaviour I’m seeing

But is this the new intended flow? We currently check in the package.json and package-lock.json file on our VCS to ensure builds are consistent across dev machines and CI/CD builds

But if mvn vaadin:clean-frontend removes these files with no method to regenerate them :thinking:

prepare-frontend should generate them (at least that’s the case if frontendHotDeploy=true - I only have those setups locally)

Starting the application using frontendHotDeploy=true does generate the files

But prepare-frontend does nothing in my case

(well it does “something”, but does not generate/create package.json, node_modules, …)

It’s done when you start the application