Javascript in Add-on modules in Jmix 2.x

In Cuba, when we build an add-on, we can define Javascript web components for the UI screens. This will be inherited by the subsequent Cuba project that installs the add-on.
However in Jmix 2.x, we can also have Javascript web components (located in frontend directory) but this is put into the Full Stack project which then depends on the add-ons that we created separately.

Can we structure the add-on project to have the Javascript web components which can be inherited by the Full Stack project ?

Hi!

JavaScript web-component don’t necessary have to be located in the frontend folder in the full-stack project. You can define them in the add-on.

You can see the definition of JavaScript components in Jmix add-ons on GitHub:

You can define a frontend folder in your project’s META-INF, like this:
image

I am attaching test projects.

add-on-starter.zip (2.7 KB)
add-on.zip (14.8 KB)

Also check out the Vaadin documentation: How to use web components in Vaadin

Best regards,
Dmitriy