Skip to content

Fixes #39137 - TypeScript support for the fronend#10899

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

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

Conversation

@Thorben-D
Copy link
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.

@Thorben-D Thorben-D requested a review from a team as a code owner March 6, 2026 12:13
@nadjaheitmann
Copy link
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

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
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
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.

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
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.

3 participants