unjs / c12

⚙️ Smart Configuration Loader
MIT License
541 stars 19 forks source link

Incorrect config file updated using the `updateConfig` function when `cwd` is missing a trailing slash #187

Closed abhi12299 closed 2 months ago

abhi12299 commented 2 months ago

Environment

Node: v20.8.1 c12: 2.0.0-beta.1

Reproduction

This issue was identified in the nuxt repo: https://github.com/nuxt/nuxt/pull/28797

Link to reproduce the issue: https://stackblitz.com/edit/stackblitz-starters-ea59nb?file=README.md

Describe the bug

Without a trailing slash at the end of cwd, the updateConfig ends up modifying the wrong file.

Additional context

No response

Logs

No response

pi0 commented 2 months ago

Thanks for nice report. fixed in latest 1.x (and v2 beta)

n0099 commented 2 months ago

v2 branch: 5b0c89ca1d16a8ee5b043d905135a9e81bc5c842