How to integrate unpkg-package as a local JsModule

Hi all,

at the moment, I use some Modules from unpkg like this, with Vaadin 14.3.

UI.getCurrent().getPage().addJsModule("https://unpkg.com/cmmn-js@0.19.2/dist/cmmn-modeler.development.js");

I would like to store this file locally, so that my application doesn’t need to be connected to the internet. I tried the @JsModule Annotation like shown, and stored the file at frontend/src/cmmn-modeler.development.js,but it didn’t work for me.

@JsModule("./src/cmmn-modeler.development.js")

I also tried storing the file at src\main\resources\META-INF\resources\frontend, but it did not work.

Do you have any advice how to accomplish this?

You can load this using this: UI.getCurrent().getPage().addJavaScript(“context://src/cmmn-modeler.development.js”).

Or

You can import it from npm with @NpmPackage: https://www.npmjs.com/package/cmmn-js

There is more information here: https://mvysny.github.io/Vaadin-difference-jsmodule-javascript/