Smidge icon indicating copy to clipboard operation
Smidge copied to clipboard

If asset fails to bundle it cause other assets from being bundled

Open bjarnef opened this issue 4 years ago • 3 comments
trafficstars

It seems if bundling of an asset fails it also cause other assets from being bundled.' In my use-case the updated autocomplete.js asset in v3.3.0 of OpenStreetMap package caused some exceptions thrown by Smidge, which also cause custom block view controllers and Contentment assets not being registered.

I reverted to v3.2.0 of OpenStreetMap package and everything seems to work again.

However should an syntax error or similar in a package JS asset cause other JS assets not being bundled? It should probably still log an error/warning, but maybe it could still process the other JS assets?

See https://github.com/bergmania/Bergmania.OpenStreetMap/issues/14

bjarnef avatar Nov 14 '21 15:11 bjarnef

I guess it could try/catch each file and continue to bundle, but if that bundle has JS in a particular order, then the JS loading may fail at runtime

Shazwazza avatar Nov 19 '21 03:11 Shazwazza

But I guess it would only be an issue within a specific part of code, e.g. in a dashboard or a package. Currently an error (e.g. just a syntax error) in a package may cause everything else to fail: Custom dashboards, block views, property ediors, prevalue editors... if the error happens early in the bundling of the assets.

Not sure if the assets are bundled in a specific order, but it seems to be in alphabetical order, as the error in Bergmania.OpenStreetMap cause missing registered controllers etc, in Contentment and own custom controllers.

bjarnef avatar Nov 19 '21 09:11 bjarnef

assets are bundled in the order you add them to a bundle. If you use file globbing patterns, then yes it will be alphabetical. Have marked as help wanted if you want to take a stab at error checking when this occurs. Would be good to have a unit test too. Let me know if you have time.

Shazwazza avatar Nov 22 '21 01:11 Shazwazza