kbss-cvut / s-forms

SForms - Semantic form generator and processor. For ontology-based smart forms.
GNU Lesser General Public License v3.0
4 stars 7 forks source link

Bundled library contains annotation that Rollup cannot interpret #282

Open blcham opened 6 months ago

blcham commented 6 months ago

Bundled SForms library is causing build warning in in Record Manager UI (see warning 2).

Here is the warning: image

For now this warning was disabled in Record Manager by commit https://github.com/kbss-cvut/record-manager-ui/pull/116/commits/eaed82ad0a2864513ed1277da736dda91c26d95e .

To test it revert the commit and run npm run build.

blcham commented 6 months ago

@LaChope please investigate ... at least find where the issue is w.r.t. source code.

blcham commented 6 months ago

Some additional notes from https://github.com/shellyear and how it works in record-manager-ui build:

LaChope commented 5 months ago

I investigated and this appears 194 times in s-forms, so I am not really able to tell what exactly causes it. All I know is that it is caused when bundling s-forms (by microbundle) and that is related to tree shaking (to optimize the bundle).

According to this comment, this is probably linked to its position. IMO, I still think it should be ignored as it does not affect the behavior of the app. We might consider changing of bundler, as microbundle does not seem to be updated (last commit is from 2 years ago).

Additional information from rollup:

TL-DR: When microbundle bundles s-forms, it generates PURE comment to optimize the bundle (eliminates pure functions), but it is badly placed (not in front of function) so it is removed by rollup.

blcham commented 5 months ago

Maybe we should choose a different library bundler, see:

After reading links above it seems that Vite is worth to try, maybe see: Create a Component Library Fast🚀(using Vite's library mode)