feat: support @ui5-ignore-import and @ui5-no-wrap pragma - #154
Merged
petermuessig merged 4 commits intoAug 22, 2026
Conversation
Extends the @ui5-ignore-import pragma to cover import() call expressions in addition to static import declarations. A block comment placed on the containing statement prevents the call from being rewritten to __ui5_require_async(). The pragma check walks to the statement parent via path.getStatementParent() because Babel attaches leading comments to the containing statement node, not to the CallExpression itself. Also fixes the static import handling: ignored imports are now left in place (early return, no path.remove()) so they appear inside the define callback body rather than being hoisted before it.
Add a README section covering the two new opt-out pragmas and a changeset (minor) for the feature. Includes a warning that @ui5-ignore-import on a static import only produces valid output in an unwrapped module.
docs: document @ui5-no-wrap and @ui5-ignore-import pragmas
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for pragma comments to allow the use of ESM imports and suppress addition of UI5 module wrappers. The purpose is to allow web workers in a UI5 project to be implemented in TypeScript, and to add support for WASM module loading.
@ui5-no-wrap
If present at the start of a file, indicates to the babel transpile that the file must not be wrapped in a sap.ui.define call. This supports the web worker use case - since worker scripts do not have access to the UI5 SDK, sap.ui.define is unsupported. This prevented workers from being implemented in TypeScript since the tooling treated them as modules.
@ui5-ignore-import
This pragma comment will cause the babel transpile to preserve an import statement on the next line instead of converting it to a sap.ui.require call. This is provided to support loading ESM modules, including web assembly code.