Read the statement by Michael Teeuw here.
Encapsule chart.js plugins?
-
@Ashaman I don’t know. but I suspect no. I would guess they clear the list on a new instance.
I have not used any plugins
yes for combining modules
-
@Ashaman awesome
-
@sdetweil
Some further testing:
If i define the chart.umd.js in the price module, and comment out the line for chart.umd.js in the consumption-module, the modules work in the order I want!getScripts: function() {
return [
this.file(‘vendor/chart.umd.js’),If the module that is listed “on top” in the config gets the chart.umd.js script, it will fix both modules.
(The lables is placed wrong in the consumption-module if it is above the price-module, but I guess that can be fixed somehow.)
Problem is solved, but I don’t know why! :grinning_face_with_sweat:
-
@Ashaman why? cause the initialization order matters to chartjs.
again, they would never see two apps on the same web page in normal life. in different tabs, sure, but those are different instances
-
@sdetweil Yes, I see that now. I also think I have a strategy if I ever need more modules using chart.js. Make sure they run the same version, and initialize in the “first” module only.
Thank you so much for your help!
-
@Ashaman cool. understand that this problem happens whenever multiple modules use the same script library.
I discovered it with QR code. my module and WiFipassword collided over different versions. wifipassword uses an older version and hasn’t been updated.i wanted to use a feature in a newer version
so much fun…