We have a SAPUI5 app in where we define multiple components (i.e., multiple Component.js files) each in a respective subfolder as direct child of the application root. The following image shows the project structure:
Component 1 is specified as com.test.component1
, component 2 as com.test.component2
. Shared code is located in root/shared
and defined as dependencies in the controllers of each component.
shared/Utils.js:
sap.ui.define([], function () {
"use strict";
return {...};
};
component1/controller/Controller1.js:
sap.ui.define([
"sap/ui/core/mvc/Controller",
"test/shared/Utils"
], function (BaseController, Utils) {
"use strict";
// controller code
});
Running the index.html file locally (or in WebIDE) this all works, but the shared resources are not found when we try to integrate the different components into the Fiori Launchpad (it tries to load them from /resources/shared). We believe this has sth to do with the data-sap-ui-resourceroots='{"com.test": ""}
defined for bootstrapping which is missing either in the Component.js or the manifest.json file.
What's the right way to register the resource path com/test/shared
for the individual components?