Skip to content

Fixes #39137 - TypeScript support for the frontend#10899

Open
Thorben-D wants to merge 1 commit intotheforeman:developfrom
Thorben-D:39137_typescript
Open

Fixes #39137 - TypeScript support for the frontend#10899
Thorben-D wants to merge 1 commit intotheforeman:developfrom
Thorben-D:39137_typescript

Conversation

@Thorben-D
Copy link
Copy Markdown
Contributor

@Thorben-D Thorben-D commented Mar 6, 2026

This commit adapts the Webpack config to allow compilation of .ts/.tsx files by Webpack.

  • Added packages:
    • typescript: 5.8.2
    • ts-loader: 9.5.2
  • Use ts-loader to load .ts/.tsx files during webpack compilation
  • Use plugin specific tsconfig.json file during compilation
  • Override module resolution of tsconfig.json from webpack config

This is the accompanying Pull-Request to the RFC in the community forum.

This commit adapts the Webpack config to allow compilation of .ts/.tsx files by Webpack.

- Added packages:
  - typescript: 5.8.2
  - ts-loader: 9.5.2
- Use ts-loader to load .ts/.tsx files during webpack compilation
- Use plugin specific tsconfig.json file during compilation
- Override module resolution of tsconfig.json from webpack config
@Thorben-D Thorben-D requested a review from a team as a code owner March 6, 2026 12:13
@nadjaheitmann
Copy link
Copy Markdown
Contributor

rpm build fails because the typescript packages are not packaged yet:
Error:
Problem 1: nothing provides requested (npm(ts-loader) >= 9.5.2 with npm(ts-loader) < 10)
Problem 2: nothing provides requested (npm(typescript) >= 5.8.2 with npm(typescript) < 6)
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

Here is the accompanying packaging PR:
theforeman/foreman-packaging#13080

Comment thread lib/tasks/gettext.rake Outdated
@@ -5,7 +5,7 @@ begin
require "gettext_i18n_rails_js/task"
require File.expand_path('../../lib/foreman/gettext/support.rb', __dir__)

FILE_GLOB = '{app,db/seeds.d,lib,config,locale,webpack}/**/*.{rb,erb,haml,slim,rhtml,js,rabl}'
FILE_GLOB = '{app,db/seeds.d,lib,config,locale,webpack}/**/*.{rb,erb,haml,slim,rhtml,js,tsx,rabl}'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why for javascript we look at .js, but not .jsx and for typescript we look at .tsx but not .ts?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TypeScript requires the .tsx extension for files that use JSX syntax, whereas for JavaScript it doesn't really matter.
I'll add .ts in case someone wants to use translation in a helper or something like that.

@nadjaheitmann
Copy link
Copy Markdown
Contributor

@Thorben-D Now that the packages are merged, can you please rebase your PR

@Thorben-D Thorben-D force-pushed the 39137_typescript branch from f5f2b41 to a4c7c1a Compare May 6, 2026 07:39
@Thorben-D Thorben-D changed the title Fixes #39137 - TypeScript support for the fronend Fixes #39137 - TypeScript support for the frontend May 6, 2026
@ogajduse
Copy link
Copy Markdown
Member

ogajduse commented May 6, 2026

I'd like to note that we're now in the Stabilization Week phase. Please consider whether you want to merge this PR before or after branching.

Ref: https://community.theforeman.org/t/foreman-3-19-schedule-and-planning/45747

@nadjaheitmann
Copy link
Copy Markdown
Contributor

I'd like to note that we're now in the Stabilization Week phase. Please consider whether you want to merge this PR before or after branching.

Ref: https://community.theforeman.org/t/foreman-3-19-schedule-and-planning/45747

@ogajduse We are not in a hurry to merge this, so we can wait after branching. I don't expect anything to break because of this, though. However, it is good to see the pipeline turning green :)

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.

4 participants