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
465 stars 69 forks source link

serve issue with missing files but returned content from directory browsing #58

Closed hschaefer123 closed 5 years ago

hschaefer123 commented 5 years ago

Expected Behavior

when previewing apps, dependencies like libraries loaded by library-preload.js will throw errors, because the preload server always returns directory info for such files?!?

This issue would not appear if directory browsing would be disabled by default for serve.

Try this http://localhost:8081/sillyfun.jpg or http://localhost:8081/sap/m/libary-preload.js

Error is

library-preload.js:1 Uncaught SyntaxError: Unexpected token <

Affected components

codeworrior commented 5 years ago

Sounds like https://github.com/SAP/ui5-server/issues/43 (which has been fixed already), or how is it different?

hschaefer123 commented 5 years ago

yep! but still an issue while #43 is closed!

RandomByte commented 5 years ago

Could you please execute ui5 --version and let us know of the result?

hschaefer123 commented 5 years ago

Hi Merlin, i am currently on holiday for one week and have no laptop with me ;-(

All my reported issues on tuesday have been dependend on the latest version of the ui tools. the installed ui5 version is 1.58.2. if i remember correct, i added sap.ui.layout and sap.m to the dependencies and the app behind the preview serve was trying to load the library-preload files (which are not available in this case), but the preview serve always returns html (even for errors). This issue is only intended for previewing webapp. The app was build correctly as self-contained app but with the reported workarounds from my side like manually adding sap.m.Router, scroller for the mCarousel isse, jquery and jquery.script, and data types used inside text formatters.

Regards Holger

RandomByte commented 5 years ago

No worries, when you are back with your notebook, could you please execute npm install -g @ui5/cli and re-test?

This is just to make sure that you are on the latest release of the UI5 Tooling.

I'm not able to reproduce the issue you describe with version 0.2.1 of the tooling. And as Frank already mentioned, this was an issue in an older release but supposedly got fixed with https://github.com/SAP/ui5-server/pull/40.

hschaefer123 commented 5 years ago

Hi guys, back from holidays and just testing it.

@RandomByte My used ui5 tools version is 0.2.1!

So i will try an update to latest version of UI5 tooling. After "npm install -g @ui5/cli" i got

but still version 0.2.1 and the issue is still there.

I am starting server with

"start": "ui5 serve -o /index-dev.html",

having lib dependencies inside manifest

"sap.ui5": {
        "dependencies": {
            "libs": {
                "sap.ui.core": {},
                "sap.ui.layout": {},
                "sap.m": {}
            }
        }
}

and also tried to put this into index.html

data-sap-ui-libs="sap.m,sap.ui.layout"

Right now i have multiple calls to preload libraries like http://localhost:8080/resources/sap/ui/core/library-preload.js and all the calls return 200 and a html site for directory browsing

Index of /resources/sap/ui/core/library-preload.js
<DIR> ...
RandomByte commented 5 years ago

Thank you. Are you able to also reproduce this behavior when running ui5 serve -o /index-dev.html directly? I.e. without "npm run" or "npm start"

hschaefer123 commented 5 years ago

Nice, running server using ui5 serve -o /index-dev.html returns 404 while npm run start (using scripts with same call) returns 200

Seems that you knowed this issue ;-)

Regards Holger

RandomByte commented 5 years ago

Maybe I do 🙂

It seems that you have installed two versions of the UI5 CLI. One globally and one locally in your project. And the latter one seems to be out of date.

Please check whether the package.json of your project references @ui5/cli as a (dev)dependency. If it does, update the version range to ^0.2.1 and execute npm install. If the package.json does not contain any reference, uninstall the projects UI5 CLI installation by executing: npm uninstall @ui5/cli.

Afterwards you may retest this issue as well as #55 and #57

I created https://github.com/SAP/ui5-cli/issues/58 to improve the user experience in case of setups like your current one.

hschaefer123 commented 5 years ago

Hi Merlin, you are right.

I started with the Demo app from Matthias Oswald https://github.com/SAP/openui5-sample-app/blob/ui5-tooling/package.json

The used dev dependency is "@ui5/cli": "^0.1.0",

Since this app is directly referenced/promoted on https://github.com/SAP/ui5-tooling

it maybe should be updated concerning your minor change from 0.1.x to 0.2 three month ago, because npm update always stays/installs old minor!

I did not expect a minor change during alpha build! Sorry for confusing you on this.

Maybe i should have an eye on your npm version history to be on latest branch.

RandomByte commented 5 years ago

Oh bummer, we'll take care and update this in the sample app.

By the way, since version 0.2.0 we notify you when using an outdated version of the CLI.

hschaefer123 commented 5 years ago

Hi Merlin, i just tested #55 and #57 and the issues are still in.

My used dependency is:

"dependencies": {
    "@openui5/sap.m": "^1.58.2",
    "@openui5/sap.ui.core": "^1.58.2",
    "@openui5/sap.ui.layout": "^1.58.2",
    "@openui5/themelib_sap_belize": "^1.58.2"
  }

and right now, 1.58.2 is the newest version inside npm.

Since the #55 (and maybe #57) dependencies needs to be fixed inside source, i have to wait for a new version available, or do you solve such issues somewhere else like json depency list, etc.

For example see line 710 inside sap.m.Carousel.js

var oScrollContainer = new sap.m.ScrollContainer({

which is not required on top!

RandomByte commented 5 years ago

Alright, we'll look into #55 and #57 separately then. Instead of waiting for a new OpenUI5 release you could also try and use an older release like 1.56.10. We may have some new issues related to dependency management in the current releases of the 1.58 codeline.

Anyway, do you think that this issue can be closed?

hschaefer123 commented 5 years ago

Yes, i will close it right now