Skip to content
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-transpile] Does not serve non-transpiled sources #1149

Closed
Kyrodan opened this issue Jan 9, 2025 · 4 comments
Closed

[ui5-tooling-transpile] Does not serve non-transpiled sources #1149

Kyrodan opened this issue Jan 9, 2025 · 4 comments

Comments

@Kyrodan
Copy link

Kyrodan commented Jan 9, 2025

Describe the bug
I have a mono-repository with an app and a library. I use transpile-middleware with success in my app using ui5-workspace.yaml. All transpilable js files get transpiled. All app modules and all dependent library modules can be successfully resolved by my consuming app.
Non-transpilable (static) resources, like manifest.json, CSS-Files etc. in dependent resources (like my library) were not served. This suits to my expectations.

Question: How can I serve these non-transpilable files?

What I tried:

  • Using (@sap/ux-ui5-tooling) fiori-tools-servestatic with a static route to the same module resource ("/resources/my/lib").
  • Using ui5-middleware-ui5
    Libraries are currently not supported, but fixed to make it work for libraries as well. But I cannot make transpile-middleware and this middlerware work at the same time.

Expected behavior
Serving non-transpilable ressources as-is.

Desktop (please complete the following information):

  • OS: Windows
  • Browser Chrome

Additional context
Using fiori-tools-proxy as well - had issues getting it correctly configured with ui5-middleware-ui5, but works with transpile-middleware.

@petermuessig petermuessig changed the title [ui5-tooling-transpile] Does not serve non-traspiled sources [ui5-tooling-transpile] Does not serve non-transpiled sources Jan 12, 2025
@petermuessig
Copy link
Member

petermuessig commented Jan 12, 2025

@Kyrodan normally all non-transpiled resource should be served by the UI5 tooling. Library dependencies are served in the /resources/%namespace% path.

There is no need to use a proxy or the ui5-middleware-ui5. The normal UI5 tooling should be sufficient.

Do you have a project to see the misbehavior?

@Kyrodan
Copy link
Author

Kyrodan commented Jan 13, 2025

Thanks @petermuessig for pointing me to the right direction. Indeed it works as mentioned, if I remove all custom middlewares.
I readded the used middlewares step by step and came to the conclusion that fiori-tools-proxy breaks the dependency resolution.
If I readd fiori-tools-proxy it stops working.

My ui5.yaml looks like:

# yaml-language-server: $schema=https://sap.github.io/ui5-tooling/schema/ui5.yaml.json
specVersion: '4.0'
metadata:
  name: my.app
customConfiguration:
  config-ui5-tooling-transpile: &cfgTranspile
    debug: true
    transformModulesToUI5:
      overridesToOverride: true
    transformAtStartup: false
    transpileDependencies: true
    filePattern: .+(js|ts)
    excludes:
      - /Component-preload.js
      - /lib/
type: application
server:
  customMiddleware:
    - name: fiori-tools-proxy
      afterMiddleware: compression
      configuration:
        ignoreCertError: false # If set to true, certificate errors will be ignored. E.g. self-signed certificates will be accepted
        backend:
          - path: /sap
            url: http://mysapserver.local:8000
        ui5:
          path:
            - /resources
            - /test-resources
          url: https://ui5.sap.com
    - name: ui5-tooling-transpile-middleware
      afterMiddleware: compression
      configuration:
        <<: *cfgTranspile
    - name: fiori-tools-appreload
      afterMiddleware: compression
      configuration:
        port: 35729
        path: webapp
        delay: 300
    - name: fiori-tools-preview
      afterMiddleware: fiori-tools-appreload
      configuration:
        component: my.app
        ui5Theme: sap_horizon

If I mount ui5 to e.g. "/resources/sapui5" (instead of "/resources") then it starts working again, but sapui5-library cannot be found by fiori-tools-preview anymore: it seems the proxied Launchpad always uses hardcoded "../resources/sap-ui-core.js" as bootstrapper-script.

@Kyrodan
Copy link
Author

Kyrodan commented Jan 13, 2025

Seems to be a similar problem like in SAP/open-ux-tools#79

But the mentioned workaround SAP/open-ux-tools#79 (comment) does not work (anymore?).

@Kyrodan
Copy link
Author

Kyrodan commented Jan 15, 2025

The updated workaround from SAP/open-ux-tools#79 (comment) works for me.

@Kyrodan Kyrodan closed this as completed Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants