-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ui5-tooling-modules] ui5-tooling-modules-middleware not importing dependencies as expected #1072
Comments
Hi @Sajantoor , the reason for that behavior is how the UI5 runtime resolves the dependencies. When using UI5 from CDN by default all resources are resolved relative to the CDN bootstrap location, e.g. if you boot from Where exactly is the dependency used? From the error log above, I assume in the By default the And QUnit and Sinon is imported in the HTML page: If you want to use a different QUnit or Sinon version this may be the better place to require them. AFAIK, we do not have an example for this scenario. But then this works differently and you need to add a proper mapping for that. It would be more ideal to work together on your code or to create a small example for that on which we can demonstrate how this could work. WDYT? Can you share your code or create a small example for this to work on? THX and BR, Peter |
I think I am experiencing the same issue. I load SAPUI5 from a custom CDN location. The ui5Loader then adds that CDN as base path to mUrlPrefixes, which causes requests for my NPM modules to go to a CDN url instead. //TestController.js
sap.ui.define(["lodash/lodash"], function (lodash) {} fails with
Proper fix to this issue will hopefully be with release of 5.0 (see SAP/ui5-tooling#976) with CDN proxy |
Hmm, well - partially yes, but as a kind of a side effect. Once UI5 is loaded from localhost:resources/*, then as a side effect lodash will be loaded from localhost:resources/lodash. Another option would be the feature like described in #1049 to also use the addToNamespace option for the middleware case - in general, the latest version of the plugin now uses addToNamespace by default for the built code, but not during development. And in case of developing and using CDN this issue here can appear. |
Closing this issue as this is related to the runtime module resolution. when loading UI5 from CDN. In this case, 3rd party packages which are not added to the namespace are not loaded from the development server and then the |
Describe the bug
I am following the documentation for setting up ui5-tooling-modules: https://www.npmjs.com/package/ui5-tooling-modules. I was able to successfully setup
ui5-tooling-modules-task
but I cannot getui5-tooling-modules-middleware
to work. I see the following when I useui5-serve
to serve my application:I do not see my expected dependencies in the
resources
directory and I don't see athirdparty
directory. This results in a runtime error in my application as it cannot find the dependencies.With my build configuration, I see my dependencies being copied over to the
thirdparty
directory and it is working as expected. I'm building usingui5 build --clean-dest
.To Reproduce
My Ui5.yaml configuration, I'm using :
(I've tried various different configurations and middleware orders as well)
Use
ui5 serve --config ui5.yaml
to serve the application. Try to access a resource that requires a third party dependency, in my case I'm importing qunit and sinon and using them in thetest
directory.Expected error:
Expected behavior
The application loads the 3rd party dependency from the
thirdparty
directory when usingui5-serve
to serve the application.Desktop:
npm packages:
Additional context
I'm using TypeScript for my application (version 5.5.4)
The text was updated successfully, but these errors were encountered: