SAP / ui5-tooling

An open and modular toolchain to develop state of the art applications based on the UI5 framework
https://sap.github.io/ui5-tooling
Apache License 2.0
466 stars 69 forks source link

Forcefully add some classes (like sap/ui/core/ComponentSupport) to a self-contained build #381

Open kristian opened 5 years ago

kristian commented 5 years ago

Expected Behavior

Only the sap-ui-custom.js boostrap JavaScript should be loaded when a self-contained build is chosen. The boostrap should contain all classes needed to run the application.

Current Behavior

Some files are anyways loaded seperately, such as the sap/ui/core/ComponentSupport in case the data-sap-ui-oninit boostrap option is chosen to load a component.

Steps to reproduce the issue

  1. Change the index.html file of the samle application to load the ComponentContainer via the data-sap-ui-oninit="module:sap/ui/core/ComponentSupport" method
  2. Build & serve the sample app self-contained

Context

Affected components

matz3 commented 5 years ago

Until we have worked out a solution, a workaround would be to manually add the dependency e.g. the Component.js module:

sap.ui.define([
  "sap/ui/core/UIComponent",
  "sap/ui/core/ComponentSupport"
], function(UIComponent) {
  "use strict";
  return UIComponent.extend("sap.ui.demo.todo.Component", {
    metadata: {
      manifest: "json"
    }
  });
});
pubmikeb commented 3 years ago

@matz3 , are there any news on the subject?

matz3 commented 3 years ago

@pubmikeb No, unfortunately not.

henriquemattos commented 4 months ago

What would be the status of this regarding TypeScript? Is this required to be imported if it's not explicitly used?

matz3 commented 4 months ago

Yes, for TypeScript there shouldn't be any difference apart from how the module dependency is defined (sap.ui.define vs import).

henriquemattos commented 3 months ago

Hi, @matz3 . Thank you for answering. These "community-driven" projects are sometimes complex, and makes it overwhelming. In the end I preferred to go via the Walkthrough Tutorial Typescript in the UI5 documentation which took me in a very simple project structure without multiple dev-dependencies.

I appreciate your time and your support.

Kind regards, Henrique

matz3 commented 3 months ago

@henriquemattos I'm glad to hear that you found a solution, but I'm having trouble to understand the context. Can you help me understanding how a project structure without multiple dev-dependencies relates to this issue about the sap/ui/core/ComponentSupport module in bundles?

henriquemattos commented 3 months ago

Hi, @matz3 . I'm sorry for the misleading comment. At the time I was working with ui5-tooling and ui5-easy-generator + generator-ui5-project, trying to bootstrap a TypeScript skeleton. I probably came across this ComponentSupport issue with one of the tutorials, and I commented on the wrong issue.

Should I delete my comment (if this is possible)?

matz3 commented 3 months ago

Ah, I understand. I don't see a reason to delete the comment, but I could do so if you want to (and maybe you can even do it by yourself).

The TypeScript Walkthrough does not mention this workaround as it does not focus on a self-contained build.