Skip to content

dynamic-plugin-sdk-webpack: Hardcoded moduleResolution Node10 breaks TypeScript 6+ (TS5107) #16258

@sachaudh

Description

@sachaudh

Summary

@openshift-console/dynamic-plugin-sdk-webpack is incompatible with TypeScript 6+ because it hardcodes moduleResolution: ts.ModuleResolutionKind.NodeJs (alias for Node10) in dynamic-module-parser.ts.

TypeScript 6 treats moduleResolution: node10 as deprecated and emits TS5107 as a hard error (diagnostic category 1). This causes getDynamicModuleMap() to throw when calling ts.getPreEmitDiagnostics(), which kills the webpack config load.

Reproduction

  1. Create an OCP plugin project using @openshift-console/dynamic-plugin-sdk-webpack (any version, including latest 4.22.0-prerelease.2)
  2. Install TypeScript >=6.0.0
  3. Run webpack build
error TS5107: Option 'moduleResolution=node10' is deprecated and will stop
functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"'
to silence this error.

[webpack-cli] Failed to load config
[webpack-cli] Error: Detected TypeScript errors while parsing modules at
  node_modules/@patternfly/react-core

Root cause

In frontend/packages/console-dynamic-plugin-sdk/src/utils/dynamic-module-parser.ts:

const defaultCompilerOptions = {
    target: ts.ScriptTarget.ES2020,
    module: ts.ModuleKind.ESNext,
    moduleResolution: ts.ModuleResolutionKind.NodeJs,  // <-- Node10, deprecated in TS6
    jsx: ts.JsxEmit.ReactJSX,
    esModuleInterop: true,
    allowJs: true,
};

These options are hardcoded with no way for consumers to override them.

Consumer impact

  • The consumer's own tsconfig.json is irrelevant -- the SDK creates its own TS program
  • No constructor parameter or config option exposes these compiler options
  • validateSharedModules: false does not help (it skips a different validation)
  • Setting sharedDynamicModuleSettings: { packageSpecs: {} } skips the call but breaks shared module optimization

Suggested fix

Option A (minimal, short-term): Add ignoreDeprecations: '6.0' to suppress the deprecation:

const defaultCompilerOptions = {
    target: ts.ScriptTarget.ES2020,
    module: ts.ModuleKind.ESNext,
    moduleResolution: ts.ModuleResolutionKind.NodeJs,
    ignoreDeprecations: '6.0',
    jsx: ts.JsxEmit.ReactJSX,
    esModuleInterop: true,
    allowJs: true,
};

Option B (forward-looking): Switch to Bundler resolution, which is functionally equivalent for this use case (the SDK only resolves relative paths within PatternFly packages' dist/esm/ and dist/dynamic/ directories):

moduleResolution: ts.ModuleResolutionKind.Bundler,

Note: node10 will stop functioning entirely in TypeScript 7.0, so Option A is only a stopgap. Option B is the long-term solution.

Affected versions

All published versions of @openshift-console/dynamic-plugin-sdk-webpack, including 4.22.0-prerelease.2 (2026-03-29).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions