flow-components icon indicating copy to clipboard operation
flow-components copied to clipboard

Production builds don't see custom components or their JS dependencies referenced by SheetChartWrapper.CHART_CREATOR_IMPL

Open WoozyG opened this issue 2 years ago • 0 comments

Description

If I set the system property named by SheetChartWrapper.CHART_CREATOR_IMPL to my own ChartCreator class, and it references in my case a custom Chart class that loads additional JS files, they are not automatically picked up by a production build, because the class is referenced indirectly.

But since this is a standard Vaadin feature, the build system should know to look for it and find dependencies and their scripts.

Unfortunately, if a project wants to set it dynamically, or via code for compile-time sanity checking, the build system wouldn't know about that value.

Perhaps an Annotation would be a better option. I can't think of a case where I would need it to be dynamic, and the component doesn't support that anyway, so an Annotation on the AppShellConfigurator implementation for an app might be more appropriate.

Barring that, a note in the Chart component documentation and JavaDoc would be helpful mentioning this.

Of course, the property isn't documented yet, and the constant String is private, so all of this really is dependent first on

#5215 :)

Expected outcome

custom ChartCreator implementations referencing custom components/JS scripts are automatically pulled into a production build.

Minimal reproducible example

can produce one if needed, but the Spreadsheet Starter with a few tweaks as described would show it.

Steps to reproduce

Define custom Chart and ChartCreator classes. Add any dummy JS to the Chart, that logs a message, for example. Production builds won't have it. The Spreadsheet starter app would be sufficient.

Environment

Vaadin version(s): 24.3.6 OS: N/A

Browsers

Issue is not browser related

WoozyG avatar Mar 04 '24 23:03 WoozyG