Configuration

pnpm (also known as performant npm) is used as the default frontend package manager instead of npm. The benefit of pnpm is that it uses a shared repository, which reduces the build time.

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

It’s still possible to use npm. To switch to npm you can set the vaadin.pnpm.enable system property to false.

For a Spring Boot based project, you can put vaadin.pnpm.enable = false into the application.properties file.

For a plain Java or a JavaEE based project, you can use Servlet 3.0 @WebServlet annotation:

Show code

Java

Expand code

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

or use the traditional web.xml file

Show code

XML

Expand code

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <web-app
  3. id="WebApp_ID" version="3.0"
  4. xmlns="http://java.sun.com/xml/ns/j2ee"
  5. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  6. xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
  7. http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
  8. <servlet>
  9. <servlet-name>myservlet</servlet-name>
  10. <servlet-class>
  11. com.vaadin.server.VaadinServlet
  12. </servlet-class>
  13. <init-param>
  14. <param-name>pnpm.enable</param-name>
  15. <param-value>false</param-value>
  16. </init-param>
  17. </servlet>
  18. <servlet-mapping>
  19. <servlet-name>myservlet</servlet-name>
  20. <url-pattern>/*</url-pattern>
  21. </servlet-mapping>
  22. </web-app>

To read more about how to set properties, see the Configuration Properties.

Alternatively, the property can be also set to the vaadin-maven-plugin, using pnpmEnable. Note that this only works for production mode.

Show code

XML

Expand code

  1. <plugin>
  2. <groupId>com.vaadin</groupId>
  3. <artifactId>vaadin-maven-plugin</artifactId>
  4. <version>${project.version}</version>
  5. <executions>
  6. <execution>
  7. <goals>
  8. <goal>build-frontend</goal>
  9. </goals>
  10. </execution>
  11. </executions>
  12. <configuration>
  13. <pnpmEnable>false</pnpmEnable>
  14. </configuration>
  15. </plugin>