fmi21
fmi21

Reputation: 545

How to control import order in UI5?

I am experiencing the following issue:

Shimmed Module C depends on Shimmed Module B which depends on Shimmed Module A.

Shims are loaded trough standard configuration in the ui5.yaml file. As they do not follow UMD, their inner deps are transparent to UI5.

At the end, SM A is dependency of a controller. For successful use however, SM B & SM C must've been loaded beforehand.

How can I accomplish successful import with guarantees of the order? Parallel imports don't do the trick for me as they may or may not follow the desired order.

Inline scripts / synchronous import calls are also undesired, as they easily violate stricter CSPs.

Any help is greatly appreciated - thanks in advance!

Upvotes: 1

Views: 115

Answers (1)

fmi21
fmi21

Reputation: 545

I managed to solve the issue using the sap.ui.loader & the official docs on AMD. Turns out, each shim can define deps section, where one can describe the inner dependencies of the packages. Using this, I could define the proper relations between them. Once this was done, the order of import happened automatically.

Upvotes: 0

Related Questions