-
Notifications
You must be signed in to change notification settings - Fork 101
Description
Describe the bug
I created some sample apps to test ui5-test-runner in different configurations.
In particular, I want to validate that it works with TS transpiling.
I have no problem running a normal JS app inside the project, but the TS one is quite challenging.
I found a workaround but I believe the problem is inside the transpiler in the way the configuration is built.
To Reproduce
- Clone ui5-test-runner repository
npm inpm run serve:sample:jsworks fine even if executed from the root but pointing to aui5.yamlinside a subfolder- Modify
./test/sample.ts/ui5.yamlto add :
resources:
configuration:
paths:
webapp: ./test/sample.ts/webappnpx ui5 serve --config ./test/sample.ts/ui5.yaml- open
http://localhost:8080/index.html - The application does not start because
Component.jsis missing (not transpiled)
Expected behavior
I would expect the TS sample to work as fine as the JS one
Desktop (please complete the following information):
- OS: Windows (reproduced on Ubuntu)
- Browser : all (server
404issue) - Version :
"@openui5/types": "^1.119.0",
"@ui5/cli": "^3.6.1",
"@ui5/middleware-code-coverage": "^1.1.0",
"typescript": "^5.2.2",
"ui5-tooling-transpile": "^3.2.6"Additional context
Enabling debug & --verbose shows :
verb server:custom-middleware:ui5-tooling-transpile-middleware Normalized configuration:
{
"debug": true,
"includes": [],
"excludes": [
".png",
".jpeg",
".jpg"
],
"filePattern": ".js",
"transformTypeScript": false,
"transformModulesToUI5": false
}
info server:custom-middleware:ui5-tooling-transpile-middleware Create Babel configuration based on ui5.yaml configuration options...
info server:custom-middleware:ui5-tooling-transpile-middleware Using browserslist configuration from ui5.yaml...
verb server:custom-middleware:ui5-tooling-transpile-middleware {
"assumptions": {},
"configFile": false,
"babelrc": false,
"filename": "<WHATEVER>\\ui5-test-runner\\src\\dummy.js",
"sourceMaps": "inline",
"targets": {},
"cloneInputAst": true,
"browserslistConfigFile": false,
"passPerPreset": false,
"envName": "development",
"cwd": "<WHATEVER>\\ui5-test-runner",
"root": "<WHATEVER>\\ui5-test-runner",
"rootMode": "root",
"plugins": [],
"presets": [
{
"options": {
"targets": {
"browsers": "defaults"
}
},
"dirname": "<WHATEVER>\\ui5-test-runner",
"file": {
"request": "@babel/preset-env",
"resolved": "<WHATEVER>\\ui5-test-runner\\node_modules\\@babel\\preset-env\\lib\\index.js"
}
}
]
}
After long debugging sessions, I finally understood that the problem comes from a combination of process.cwd() and the location
of package.json. The transpiler configures itself as it in the project root instead of the folder where ui5.yaml stands.
I found a way to 'hack' this but I would expect the whole thing to run fine without hack...
