ui5-community / ui5-ecosystem-showcase

A repository showcasing the UI5 tooling extensibility to combine OSS tools for UI5 application development.
https://ui5-community.github.io/ui5-ecosystem-showcase/
Other
191 stars 92 forks source link

[ui5-tooling-modules] Third party library added to Fiori UI application is failing to load #927

Closed longieirl closed 9 months ago

longieirl commented 9 months ago

Describe the bug Appending ui5-tooling-modules to an existing Fiori UI application fails to load the third party module. Downgrading to v3.2.4 works fine.

To Reproduce Down sample project in the following PR which has a hardcode dependency of version v3.2.4 https://github.com/SAP-samples/fiori-tools-samples/pull/36

Project dependencies are listed as;

    "dependencies": {
        "ui5-tooling-modules": "3.2.5",
        "xml-js": "^1.6.11"
    },
    "devDependencies": {
        "@sap-ux/ui5-middleware-fe-mockserver": "2",
        "@sap/ui5-builder-webide-extension": "^1.1.8",
        "@sap/ux-ui5-tooling": "1",
        "@ui5/cli": "^3.0.0",
        "mbt": "^1.2.18",
        "ui5-task-zipper": "^0.5.0"
    },

The project is a created as a Fiori UI Freestyle application. Using the following commands, the UI app fails to load

npm run start

or

npm run start-noflp

Expected behavior Project is loaded and third party library is consumed.

Actual behavior Console log is showing an exception and the UI app fails to load the third party module.

The following exception is thrown;

Uncaught (in promise) ModuleError: Failed to resolve dependencies of 'ztest/docapp1/ztravel/controller/View1.controller.js'
 -> 'xml-js.js': failed to execute module factory for ''xml-js.js'': exports is not defined
    at ye (http://localhost:8080/resources/sap-ui-core.js:10:7867)
    at pe.failWith (http://localhost:8080/resources/sap-ui-core.js:10:5704)
    at http://localhost:8080/resources/sap-ui-core.js:10:18086
Caused by: ModuleError: failed to execute module factory for ''xml-js.js'': exports is not defined
    at ye (http://localhost:8080/resources/sap-ui-core.js:10:7867)
    at pe.failWith (http://localhost:8080/resources/sap-ui-core.js:10:5704)
    at d (http://localhost:8080/resources/sap-ui-core.js:10:17729)
Caused by: ReferenceError: exports is not defined
    at http://localhost:8080/resources/xml-js.js:3571:38
    at d (http://localhost:8080/resources/sap-ui-core.js:10:17556)

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

petermuessig commented 9 months ago

Hi @longieirl ,

since the version upgrade of the 3rd party dependencies from rollup, there are some issue how the 3rd party models are exported. I hope I find a solution soon...

petermuessig commented 9 months ago

Related to #915

petermuessig commented 9 months ago

ui5-tooling-modules version 3.2.6 should fix the issue!