Skip to content

[Bug]: When in bundleless mode, rspack plugins do not call normalModuleFactory.hooks.resolve on import declarations #1286

@davidferguson

Description

@davidferguson

Version

System:
    OS: macOS 15.1.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 96.69 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 141.0.7390.108
    Firefox: 138.0.3
    Safari: 18.1.1
  npmPackages:
    @rslib/core: ^0.16.0 => 0.16.0

Details

When rslib is set to output in bundleless mode (bundle: false), any registered rspack plugins do not call the normalModuleFactory.hooks.resolve hook on import declarations in the source files.

When rslib is set to output in bundleless mode (bundle: false), a rspack plugin provided to the rslib configuration (tools.rspack.plugins) will not call the normalModuleFactory.hooks.resolve hook for imports in the source files. It will call it on the result of the source.entry glob, but it does not loop through the imports of each source file, calling the hook, as I would expect.

I would expect this especially because it does call the beforeResolve hook on these imports, but then does not call resolve.


This is needed for my use case, as I am using a plugin that, combined with a component library, generates CSS files at build time. It will add the imports to the source files as needed, and then it waits for the the resolve to be called on the path, in order to write out the corresponding CSS file. Because resolve is not being called, the plugin is failing to write out the CSS files.

Reproduce link

https://github.com/davidferguson/rslib-bundle-noresolve

Reproduce Steps

Described in the reproduction repo readme

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions