I am using the UI5 Tooling (version 2.14.9) in order to serve locally a project along with its custom library. Both projects are developed with OpenUI5 version 1.84.
My ui5.yaml
is configured as follows (only relevant parts are reported)
specVersion: "2.6"
metadata:
name: "launchpad"
type: module
resources:
configuration:
paths:
/my/app/: packages/my_app/webapp
/resources/library/: packages/library/src/my_library
server:
customMiddleware:
........
- name: ui5-middleware-simpleproxy
afterMiddleware: compression
mountPath: /XMII/
configuration:
baseUri: "http://ip:port/XMII/"
username: "user"
password: "pw"
In my index.html
:
<script id="sap-ui-bootstrap" src="..."
data-sap-ui-resourceroots='{
"my.app": "./",
"my.library": "/resources/library"
}'
...
></script>
The app crashes because it tries to load some of the library files on the deployment server rather than locally and gives me a 404 - File not found
error. The library is fully served by the "ui5 serve
" command (also the files that the app is trying to reach on the server) and a lot of its files are correctly loaded from the local directory so I can't find a motivation for this behavior.
I'm not in a Fiori environment (I'm using VSCode and not SAP BAS) and I triple checked namespaces when importing in the app files from library.
EDIT
I found a partial solution which confuses me a lot: I added in my bootstrap script a new alias pointing towards the same resource and changed the reference (only for my crashing imports) and now all files are loaded locally. But why????
<script id="sap-ui-bootstrap" src="..."
data-sap-ui-resourceroots='{
"my.app": "./",
"my.library": "/resources/library",
"library": "/resources/library"
}'
...
></script>
After almost a year I just find out the root cause of the issue which was affecting only a small amount of files in our project: somewhere in old legacy code was hidden this line
jQuery.sap.registerModulePath('my.library', '/onlinepath/to/my/library');
This line was overriding all my efforts to use local library files, pointing explicitly to their online version.