Vaadin proposes to user pnpm instead of npm as it seems quicker and saves disk space.
To achieve this goal one can use several ways, see Vaadin 15 for complete details:
- In Spring: in the application.properties file, set this property vaadin.pnpm.enable=true
- In a plain JEE application with the @WebServlet annotation (is the one I use)
- In a plain JEE application by means of the web.xml file
- In the pom.xml file, in the part of the vaadin-maven-plugin
My option is using the @WebServlet annotation, as in my project, I used this class to define the management of internationalization and CDI. Here is the source code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | package openadmin.listeners; import javax.servlet.annotation.WebInitParam; import javax.servlet.annotation.WebServlet; import com.vaadin.cdi.CdiVaadinServlet; import com.vaadin.flow.server.Constants; /** * Information about app servlet * * Necessary for defining i18n Provider * @author ximo * */ @SuppressWarnings("serial") @WebServlet( urlPatterns = "/*", name = "slot", asyncSupported = true, initParams = { // I18N Provider for translation of labels @WebInitParam(name = Constants.I18N_PROVIDER, value = "openadmin.i18n.MyI18nProvider"), // Enable pmpm instead of npm @WebInitParam(name = "pnpm.enable", value = "true") }) public class ApplicationServlet extends CdiVaadinServlet { } |