[5.3] MSTR-275: do not require sub module, let core handle it #522
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If the app assets is loading from external
source_url
, if the app tries to require its sub modules directly it will fail and the app won't load at all.Changing the module name to its external
source_url
as what Monster UI core was previously doing won't always work in case the sub modules were small enough and optimized away in a single file asapp.js
. This has been observed withbranding
andcall-recording
apps so far.Instead we can explicitly config the paths for sub module and its external source url for
requirejs
to load it, if it is not already optimized in theapp.js
.Without this change, because
app.js
is requiring the submodules, this URL will be used instead of external source_url:requireSubModule
frommonster.apps.js
will require all submodules defined on the app and can adds externalsource_url
of the sub module in requirejs config so the correct URL will be used for fetch if it is needed:Read more: https://requirejs.org/docs/jquery.html#modulename