Skip to content

Fix .ts/.tsx UI overrides being silently ignored in Publisher and Devportal - #1411

Merged
PasanT9 merged 1 commit into
wso2:mainfrom
Shamly-Shanawaz:fix/5161-tsx-override-loader
Aug 10, 2026
Merged

Fix .ts/.tsx UI overrides being silently ignored in Publisher and Devportal#1411
PasanT9 merged 1 commit into
wso2:mainfrom
Shamly-Shanawaz:fix/5161-tsx-override-loader

Conversation

@Shamly-Shanawaz

@Shamly-Shanawaz Shamly-Shanawaz commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Problem

.ts/.tsx files placed under <webapp>/override/src for Advanced UI Customization are silently ignored. The build completes with exit code 0 and emits no error or warning, so the missing override is very hard to detect. .js/.jsx overrides are applied correctly.

Related Issue : Fixes wso2/api-manager#5161

Root cause

loader.js performs the source/srcoverride/src substitution, but it is registered only on the /\.(js|jsx)$/ webpack rule. It is absent from the /\.tsx?$/ rule, so TypeScript modules bypass the substitution entirely and are compiled straight from source/src.

Fix

Register loader.js on the /\.tsx?$/ rule in both portals. It is listed after ts-loader so it runs first - webpack executes a use array bottom-to-top, substituting the override before TypeScript compiles it. This mirrors the ordering already used by the adjacent /\.(js|jsx)$/ rule.

  • portals/publisher/src/main/webapp/webpack.config.js
  • portals/devportal/src/main/webapp/webpack.config.js

The Admin portal is unaffected: no .tsx? rule, no ts-loader, no tsconfig.json, no override/ directory, zero TypeScript sources.

Behaviour change

Because override TypeScript is now genuinely compiled, it is also type-checked against the web app's tsconfig.json (strict mode). A .ts/.tsx file under override/src containing a type error previously built green because it was
never read, it will now fail the build with a TypeScript diagnostic. Nothing changes until the web application is next rebuilt.

Testing

Verified per portal by overriding a matched .tsx/.jsx pair with distinct sentinel strings and grepping site/public/dist/*.bundle.js:

before after
.tsx override sentinel 0 1
.jsx override sentinel (control) 1 1
original literal present absent

The .jsx control passing in both builds isolates the failure to the TypeScript path. Confirmed for build:prod and build:dev, and at rendered-UI level in a running server. Also confirmed a type-broken override .tsx now fails the build
(TS2322), substantiating the behaviour-change note.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The Devportal and Publisher webpack configurations now apply loader.js after ts-loader for TypeScript and TSX files.

Changes

TypeScript loader integration

Layer / File(s) Summary
Extend TypeScript webpack loader chains
portals/devportal/src/main/webapp/webpack.config.js, portals/publisher/src/main/webapp/webpack.config.js
Both TypeScript and TSX rules now add loader.js after ts-loader.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related issues

  • wso2/api-manager#5161 — Adds loader.js to the Publisher and Devportal TypeScript webpack rules to enable .ts and .tsx overrides.

Suggested reviewers: ashera96

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the fix for ignored TypeScript UI overrides in the Publisher and Devportal applications.
Description check ✅ Passed The description directly explains the TypeScript override issue, root cause, fix, behavior change, and testing.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Shamly-Shanawaz
Shamly-Shanawaz force-pushed the fix/5161-tsx-override-loader branch from bc95568 to ada2b4f Compare August 10, 2026 08:05
@sonarqubecloud

Copy link
Copy Markdown

@PasanT9
PasanT9 merged commit 8ee0596 into wso2:main Aug 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[APIM 4.6.0] Publisher webpack.config.js — loader.js missing from .tsx? rule; TypeScript UI overrides silently ignored

2 participants