Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

overrides doesn't override but extends default arrays and objects #113

Open
tmlmt opened this issue Oct 22, 2023 · 0 comments
Open

overrides doesn't override but extends default arrays and objects #113

tmlmt opened this issue Oct 22, 2023 · 0 comments

Comments

@tmlmt
Copy link

tmlmt commented Oct 22, 2023

Environment

  • node: v18.18.0
  • c12: v1.5.1

Reproduction

https://stackblitz.com/edit/stackblitz-starters-13rkzj?file=index.js

Describe the bug

The use of defu to merge sources in

c12/src/loader.ts

Lines 112 to 119 in 54ed82b

// Combine sources
r.config = defu(
options.overrides,
config,
configRC,
pkgJson,
options.defaultConfig,
) as T;

makes it such that a default array (or object) is not overridden but extended by the array (or object) given in override.

Is this the intended behavior?

image

Additional context

If one wants to provide a default list customizable by the user, it forces one to flatten the list in a string.

Logs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant