on 07-14-2023 7:03 AM
I have a UI5 application which will use views and controllers, from another UI5 repo. To achieve this I have created 2 apps ( UI5 repo ) as
The code looks like below
index.html of commonui
sap.ui.define(
["sap/ui/core/mvc/Controller", "sap/ui/core/routing/History", "sap/ui/core/UIComponent"],
function (Controller, History, UIComponent) {
"use strict";
return Controller.extend("com.testapp.commonui.controller.BaseController", {
formatter: formatter,
getModel: function (sName) {
return this.getView().getModel(sName);
},
})
xs-app.json of commonui
"welcomeFile": "/index.html",
"authenticationMethod": "route",
"logout": {
"logoutEndpoint": "/do/logout"
},
"routes": [
{
"source": "^(.*)$",
"target": "$1",
"service": "html5-apps-repo-rt",
"authenticationType": "xsuaa"
}
]
}
index.html of mainappui
//
..... Showing only the resourceroots
data-sap-ui-resourceroots='{
"com.testapp.mainappui": "./",
"com.testapp.commonui.": "./../comtestappcommonui./"<br> }'
//......
mta.yaml
ID: lastmile
_schema-version: 3.2.0
version: 0.0.1
parameters:
enable-parallel-deployments: true
modules:
- name: webapp_deployer
type: com.sap.application.content
path: deployer
requires:
- name: main_html5_repo_host
parameters:
content-target: true
build-parameters:
build-result: resources
requires:
- name: commonui
artifacts:
- dist/commonui.zip
target-path: resources/
- name: mainappui
artifacts:
- dist/mainappui.zip
target-path: resources/
- name: commonui
type: html5
path: commonui
build-parameters:
builder: custom
commands:
- npm run build:commonui --prefix ..
supported-platforms: []
- name: mainappui
type: html5
path: mainappui
build-parameters:
builder: custom
commands:
- npm run build:mainappui --prefix ..<br> supported-platforms: []
resources:
- name: main_html5_repo_host
type: org.cloudfoundry.managed-service
parameters:
service-plan: app-host
service: html5-apps-repo
When I launch the app, the mainappui is fetching the BaseController.js from different URL/Domain
Please let me know what is wrong here
It seems that resourceRoots does not work here.
Try setting it in the manifest.json like:
"resourceRoots": {
"com.testapp.commonui": "USEYOURPATHHERE"
},
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
72 | |
9 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.