Skip to content

Temporary fixed schema-utils to 4.7.0 for gradle plugin tests (JS) - #5766

Merged
Vladimir Mazunin (mazunin-v-jb) merged 1 commit into
masterfrom
v.mazunin/webpack-compilation-error-gradle-plugin-tests
Oct 22, 2026
Merged

Vladimir Mazunin (mazunin-v-jb) merged 1 commit into
masterfrom
v.mazunin/webpack-compilation-error-gradle-plugin-tests

Conversation

@mazunin-v-jb

Copy link
Copy Markdown
Contributor

Fixes:
CMP-10985 CI: Gradle Plugin web/wasm tests fail — webpack compilation TypeError (KT-80014)

Release Notes

N/A

@eymar

Copy link
Copy Markdown
Member

For the record, the alternative workaround suggested by the Kotlin team is this:

plugins.withType<NodeJsRootPlugin> {
    extensions.configure<NodeJsRootExtension>("kotlinNodeJs") {
        versions.webpack.version = "5.112.0"
    }
}

And RCA for the reference:

Kotlin pins the webpack version, but doesn't pin the webpacks dependencies.
So `"schema-utils": "^4.3.3"` brought a newer schema-utils 4.8.0

The failure comes from two webpack instances being loaded into the same build:

1. schema-utils 4.8.0 introduced an optional peer dependency on webpack ^5.112.0. Version 4.7.0 has no webpack peer dependency. [Dependency change](https://github.com/webpack/schema-utils/compare/v4.7.0...v4.8.0).
2. In Kotlin’s npm workspace layout, npm can install a newer webpack at the root while retaining Kotlin’s pinned webpack inside a workspace. The compiler and plugins can then load different copies.
3. Each webpack copy defines its own Compilation class. A compilation created by one copy fails the other copy’s compilation instanceof Compilation check, producing the reported TypeError. [Webpack check](https://github.com/webpack/webpack/blob/v5.100.2/lib/javascript/JavascriptModulesPlugin.js#L208-L213). This is the mechanism explained in [KT-80014](https://youtrack.jetbrains.com/issue/KT-80014).

The pin removes the peer dependency that triggers that resolution.

gradle.projectsEvaluated {
def root = gradle.rootProject
["kotlinNpm", "kotlinWasmNpm"].each { extensionName ->
root.extensions.findByName(extensionName)?.override("schema-utils", "4.7.0")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just a note for the future: this workaround will become obsolete when newer Kotlin pins a newer wepback version.

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.

Made a task for reverting that in future
CMP-10987 Revert schema-utils pin after KGP pins new webpack version

@mazunin-v-jb
Vladimir Mazunin (mazunin-v-jb) merged commit 139e2fc into master Oct 22, 2026
13 checks passed
@mazunin-v-jb
Vladimir Mazunin (mazunin-v-jb) deleted the v.mazunin/webpack-compilation-error-gradle-plugin-tests branch October 22, 2026 11:02
Vladimir Mazunin (mazunin-v-jb) added a commit that referenced this pull request Oct 22, 2026
…5766)

Fixes:
[CMP-10985](https://youtrack.jetbrains.com/issue/CMP-10985) CI: Gradle
Plugin web/wasm tests fail — webpack compilation TypeError (KT-80014)

## Release Notes
N/A

(cherry picked from commit 139e2fc)
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