Relative paths for project shims
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript
- 領域
- build-system, cli, tooling
調査の方向性
Start by comparing project-shim path handling in ui5 serve and ui5 build, using the ui5.yaml shim configuration and manifest.json resource entries described here. Trace how the paths become entries in dist; done means the same shim paths work during serving and after building without conditional manifest changes.
索引モデルが issue の本文から書いたものです。
説明
Is your feature request related to a problem? Please describe.
Currently there is a mismatch for project shims regarding their paths when running ui5 serve and after running ui5 build.
Let's have a look at the following configuration (according to this example)
---
# Shims for thirdparty modules
specVersion: "2.3"
kind: extension
type: project-shim
metadata:
name: thirdparty-shims
shims:
configurations:
# polyfill for ECMAScript features
core-js-bundle:
specVersion: "2.3"
type: module
metadata:
name: core-js-bundle
resources:
configuration:
paths:
/resources/my/app/namespace/thirdparty/core-js-bundle/: ""
# transpile generator functions (~ async await)
regenerator-runtime:
specVersion: "2.3"
type: module
metadata:
name: regenerator-runtime
resources:
configuration:
paths:
/resources/my/app/namespace/thirdparty/regenerator-runtime/: ""
In particular above project shims have been defined to provide some polyfills when using e.g.
To ensure that these polyfills are being loaded as early as possible they have to be defined as js resources in the app's manifest.json:
{
"sap.ui5": {
"resources": {
"css": [],
"js": [
{
"uri": "/resources/my/app/namespace/thirdparty/core-js-bundle/minified.js"
},
{
"uri": "/resources/my/app/namespace/thirdparty/regenerator-runtime/runtime.js"
}
]
}
}
}
This works perfectly fine when running the app locally using ui5 serve.
The issue occurs when building the app (additionally using ui5-task-copy-shim-resource to ensure the project shims / polyfills are being copied over to the dist folder):
builder:
resources:
excludes:
- "**/test/**"
- "**/localService/**"
customTasks:
# babel
- name: ui5-task-babel
afterTask: replaceVersion
# copy-shim-resources
- name: ui5-task-copy-shim-resources
afterTask: ui5-task-babel
configuration:
paths:
- "/resources/my/app/namespace/thirdparty/core-js-bundle/minified.js"
- "/resources/my/app/namespace/thirdparty/regenerator-runtime/runtime.js"
After running ui5 build the dist folder will contain a thirdparty folder, hence the paths for the js resources defined in manifest.json will not match anymore, they would have to be adjusted now omitting the /resources/my/app/namespace prefix to match the dist folder structure.
{
"sap.ui5": {
"resources": {
"css": [],
"js": [
{
"uri": "/thirdparty/core-js-bundle/minified.js"
},
{
"uri": "/thirdparty/regenerator-runtime/runtime.js"
}
]
}
}
}
Describe the solution you'd like
For normal project shims which are only being loaded via sap.ui.define this will not be an issue.
But for js resources such as polyfills which have to be included in manifest.json it should be possible to define their paths omitting the ´/resources/my/app/namespace` prefix so that the paths for shims are always relative to the projects webapp folder and namespace.
E.g.
---
# Shims for thirdparty modules
specVersion: "2.3"
kind: extension
type: project-shim
metadata:
name: thirdparty-shims
shims:
configurations:
# polyfill for ECMAScript features
core-js-bundle:
specVersion: "2.3"
type: module
metadata:
name: core-js-bundle
resources:
configuration:
paths: # relative to webapp folder / namespace
/thirdparty/core-js-bundle/: ""
# transpile generator functions (~ async await)
regenerator-runtime:
specVersion: "2.3"
type: module
metadata:
name: regenerator-runtime
resources:
configuration:
paths: # relative to webapp folder / namespace
/thirdparty/regenerator-runtime/: ""
Describe alternatives you've considered
It would be possible to do some conditional sap.ui.loader.config and sap.ui.requireSync at the start of Component.js instead of manifest.json:sap.ui5/resources/js but that is something I would rather avoid.
Additional context
The full ui5.yaml would look like this:
specVersion: "2.3"
metadata:
name: my-app
type: application
framework:
name: SAPUI5
version: "1.84.4"
libraries:
- name: sap.m
- name: sap.ui.core
- name: sap.suite.ui.generic.template
- name: themelib_sap_fiori_3
optional: true
- name: sap.ushell
development: true
- name: sap.ui.fl
development: true
server:
customMiddleware:
# livereload
- name: fiori-tools-appreload
afterMiddleware: compression
configuration:
ext: html,js,json,xml,properties,change
# service proxy
- name: ui5-middleware-http-proxy
mountPath: /sap
afterMiddleware: compression
configuration:
baseUrl: https://my.abap.system:44311
path: /sap
secure: false
auth:
user: env:ABAP_SYSTEM_USERNAME
pass: env:ABAP_SYSTEM_PASSWORD
# layered respository / flexibility
- name: ui5-middleware-lrep-flex
afterMiddleware: compression
configuration:
# handle e.g. GET /sap/bc/lrep/flex/data/bookshop.ui.Component?appVersion=1.0.0&sap-language=en
component:
# data to be merged to each .change file
changeData:
support:
user: "SAP"
validAppVersions:
creation: "0.1.0"
from: "0.1.0"
to: "0.1.0"
# data to be merged and sent for each response
data:
settings:
isKeyUser: true
isAtoAvailable: false
isProductiveSystem: false
# babel
- name: ui5-middleware-babel
afterMiddleware: compression
configuration:
enabled: true
wrap: true
excludes:
- "/test/**"
- "/localService/**"
- "/resources/my/app/namespace/thirdparty/core-js-bundle/**"
- "/resources/my/app/namespace/thirdparty/regenerator-runtime/**"
builder:
componentPreload:
excludes:
- "**/thirdparty/core-js-bundle/**"
- "**/thirdparty/regenerator-runtime/**"
resources:
excludes:
- "**/test/**"
- "**/localService/**"
customTasks:
# babel
- name: ui5-task-babel
afterTask: replaceVersion
# copy-shim-resources
- name: ui5-task-copy-shim-resources
afterTask: ui5-task-babel
configuration:
paths:
- "/resources/my/app/namespace/thirdparty/core-js-bundle/minified.js"
- "/resources/my/app/namespace/thirdparty/regenerator-runtime/runtime.js"
---
# Shims for thirdparty modules
specVersion: "2.3"
kind: extension
type: project-shim
metadata:
name: thirdparty-shims
shims:
configurations:
# polyfill for ECMAScript features
core-js-bundle:
specVersion: "2.3"
type: module
metadata:
name: core-js-bundle
resources:
configuration:
paths:
/resources/my/app/namespace/thirdparty/core-js-bundle/: ""
# transpile generator functions (~ async await)
regenerator-runtime:
specVersion: "2.3"
type: module
metadata:
name: regenerator-runtime
resources:
configuration:
paths:
/resources/my/app/namespace/thirdparty/regenerator-runtime/: ""
- 主要言語
- JavaScript
- スター
- 510
- フォーク
- 80
- 平均マージ
- 2日 22時間
- マージ済み PR(30日)
- 12
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
UI5/cli のほかの issue
-
Build cache: buildThemes cache is invalidated by irrelevant library.js / .library content changesオープンmodule/ui5-builder module/ui5-fs module/ui5-project
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
メンテナーはふだん 2 日以内に返信
-
module/ui5-project
難易度 4/5 3〜5日 初心者へのやさしさ 64/100
メンテナーはふだん 2 日以内に返信
-
[ROADMAP] UI5 CLI 6.0 / Specification Version 6.0再び着手できるかも @flovogt が 116 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンroadmap
UI5/cli#1485 · リアクション 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
build excludes from application project are not applied to dependencies再び着手できるかも @flovogt が 90 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
UI5/cli#1446 · コメント 3 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
help provided
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 2 日以内に返信
似ている issue
-
bug confirmed issue
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
open-webui/open-webui#35507 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
beginner-friendly category:tests community enhancement first-timers-only good first issue help wanted low hanging fruit micro-contribution type: task up-for-grabs
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
Berserk-hub150/skillhawk#300 · コメント 1 件 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Fei2411/DeepSeek-Bot#2896 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
area:ui P2 status:blocked
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
sunososobro-hub/cloudball#1234 ·
メンテナーはふだん 1 日以内に返信