Documentation versions (currently viewingVaadin 23)

Configuring npm/pnpm

npm is the recommended and default package manager for Vaadin projects.

Install a Custom Package

To install a custom front-end package into your project with npm, run npm i xxx. For example, to add the mobx package as a dependency in package.json as well as install it into node_modules, run the following command in the project directory:

npm i mobx
Vaadin expects transitive platform dependencies to be available directly under node_modules. Vaadin uses the npm overrides feature (since npm 8.3.0) to lock the transitive platform dependencies versions.

Switch Between npm and pnpm

npm is used as the default front-end package manager.

Vaadin also supports using pnpm (also known as performant npm). To switch to pnpm, you can set the vaadin.pnpm.enable system property to true.

When using pnpm, the framework will install it locally using npm if it is not installed globally. The package-lock.json file that is used by npm is incompatible with pnpm and is removed automatically if pnpm is used. pnpm uses the pnpm-lock.yaml file instead of package-lock.json. This means that any custom dependency configurations should go to pnpm-lock.yaml.

Switch between npm and pnpm in a Spring Boot Project

For a Spring Boot-based project, you can add vaadin.pnpm.enable = true to the file.

Switch Between npm and pnpm in a Plain Java or JavaEE Project

For a plain Java or a JavaEE-based project, you can set the pnpmEnable configuration property inside the vaadin-maven-plugin.


Alternatively, you can use the Servlet 3.0 @WebServlet annotation:

@WebServlet(urlPatterns = "/*", name = "myservlet", asyncSupported = true, initParams = {
        @WebInitParam(name = "pnpm.enable", value = "true") })
public class CustomServlet extends VaadinServlet {

or use the traditional web.xml file:

<?xml version="1.0" encoding="UTF-8"?>
  id="WebApp_ID" version="3.0"




For more about how to set properties, see Configuration Properties.