Skip to content

Conversation

@Ubuntu-Buddha
Copy link

Summary

Adds a remappings_scope config option that controls whether dependency remappings are included when loading config. When set to global, only project-level remappings are used and remappings from nested foundry.toml files in dependencies are ignored.

This addresses the issue where Soldeer and similar package managers have dependencies that ship their own remappings.txt files pointing to node_modules/ paths which don't exist in the project.

Changes

  • Add RemappingsScope enum (Default | Global) in crates/config/src/lib.rs
  • Add remappings_scope field to Config struct (default: Default)
  • Update RemappingsProvider to skip find_nested_foundry_remappings() when scope is Global
  • Add test test_remappings_scope_global_ignores_dependency_remappings

Usage

[profile.default]
remappings_scope = "global"
remappings = ["@dep/=lib/dep/"]

With this config, remappings defined in lib/dep/foundry.toml are ignored, and only the project's remappings are used.

Test Plan

  • Added unit test verifying dependency remappings are excluded when remappings_scope = "global"
  • All existing config tests pass (141 unit tests + 19 doctests)

Closes #12420

Adds a `remappings_scope` config option that controls whether dependency
remappings are included. When set to `global`, only project-level
remappings are used and remappings from nested foundry.toml files in
dependencies are ignored.

This is useful for Soldeer and similar package managers where dependencies
ship their own remappings.txt files that reference paths like node_modules/
which don't exist in the project's structure.

Usage:
```toml
[profile.default]
remappings_scope = "global"
```

Closes foundry-rs#12420
@Ubuntu-Buddha Ubuntu-Buddha force-pushed the feat/global-remappings-12420 branch from 484f108 to 98d5ff6 Compare February 3, 2026 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

feat(config): global remapping override of dependencies

1 participant