Skip to content

Webpack compilation error in jsTest: Cannot find module 'webpack/lib/index' #2

@sydneyrenee

Description

@sydneyrenee

Issue Description

During the multiplatform test build, the jsTest target is failing with a webpack module resolution error.

Error Details

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileTestDevelopmentExecutableKotlinJs'.
> Could not resolve all files for configuration ':jsTestRuntimeClasspath'.
   > Failed to transform kotlin-test-js-1.9.10.klib to match attributes ...
     > Execution failed for JsIrTransformer: ...
       > org.jetbrains.kotlin.cli.common.ExitCode$INTERNAL_ERROR: Uncaught exception
         > e: java.lang.RuntimeException: Module not found: Error: Can't resolve 'webpack/lib/index' ...

Context

  • Kotlin Version: 1.9.10
  • Gradle Task: :compileTestDevelopmentExecutableKotlinJs
  • Configuration: :jsTestRuntimeClasspath

Technical Analysis

The error occurs during the Kotlin/JS IR transformation phase when webpack tries to resolve its internal module structure. This appears to be a webpack configuration or compatibility issue with the Kotlin Multiplatform setup.

Potential Causes

  1. Webpack version mismatch between Kotlin's requirements and what's available
  2. Missing webpack dependencies in the build configuration
  3. Incompatibility between kotlin-test-js and the webpack version

Impact

  • Blocks JS target testing
  • Only affects jsTest target; JVM tests complete successfully

Reproduction

Run: ./gradlew test or ./gradlew jsTest

Workaround

Currently running JVM tests only: ./gradlew jvmTest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions