Skip to content

panic: Module should be added before using when bundling lodash-es with swc-loader #15136

Description

@Ceeeebb

Summary

Rspack panics while processing modules from lodash-es through swc-loader.

Error

Two instances were reported:

Message: Module(javascript/esm|builtin:swc-loader??ruleSet[1].rules[7].use[0]!/Users/leozang/workspace/pages/node_modules/lodash-es/_Stack.js) should be added before using
Location: crates/rspack_core/src/chunk_graph/chunk_graph_module.rs:153
Message: Module(javascript/esm|builtin:swc-loader??ruleSet[1].rules[7].use[0]!/Users/leozang/workspace/pages/node_modules/lodash-es/startsWith.js) should be added before using
error Command failed with exit code 1.

Backtrace

The runtime output says the backtrace was omitted. Re-running with RUST_BACKTRACE=1 (or RUST_BACKTRACE=full for source snippets) should provide the missing diagnostic details.

Expected behavior

Rspack should handle these lodash-es modules without panicking, or produce a recoverable compilation error with actionable context.

Additional context

The failing module identifiers show builtin:swc-loader at ruleSet[1].rules[7].use[0]. Exact Rspack, Node.js, loader, and project versions were not included in the report.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions