Skip to content

loaderContext.importModule() returns {} for asset/resource instead of its URL #22863

Closed

Description

@malash

Have you used AI?

Yes

Which part of webpack is affected?

loaders

Bug Description

A custom loader calls this.importModule() with a request explicitly typed as asset/resource. With webpack 5.112.0, the resource file is emitted, but the call resolves to an empty object ({}) instead of its URL string.

Link to Minimal Reproduction and steps to reproduce

https://github.com/malash/webpack-issue-22863

Switch between bad-case and good-case branches to reproduce the issue.

Expected Behavior

Return resource's URL

Actual Behavior

Return an empty object {}

Environment

Webpack 5.112.0

Is this a regression?

Yes (please specify version below)

Last Working Version

v5.95.0

Additional Context

Commits that might be related to this bug:

485f3d6
737c16c

Activity

  1. added theissue type on Oct 23, 2026
  2. added
    area: loadersLoader execution and loader API (lib/loaders)
    regressionWorked in a previous release; pair with the Affected version field
    on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: loadersLoader execution and loader API (lib/loaders)needs: reproductionNo runnable minimal reproduction yetregressionWorked in a previous release; pair with the Affected version field

    Type

    Fields

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions