c12
c12 copied to clipboard
Support `extends` from different config file name
Environment
node: v16.14.2 "c12": v1.1.2
Reproduction
https://stackblitz.com/edit/c12-bug-extends?file=index.mjs
Describe the bug
The extends option does not load configuration files in subdirectories, nor does it load configuration from npm packages.
❯ node index.mjs
Cannot extend config from `./base/config.dev.ts` in /home/projects/c12-bug-extends
{ config: true }
Additional context
No response
Logs
No response
Hi. The config file in sub-directory should exist with expected name (config.ts). fixed sandbox
Is there a specific usecase you wanting to use .dev.ts in base?
Hi. The config file in sub-directory should exist with expected name (
config.ts). fixed sandboxIs there a specific usecase you wanting to use
.dev.tsin base?
Changing the file name does work, but the official use case supports a similar configuration as config.dev.ts below, and it is clear that the extends option should not be restricted by naming, and any file specified as an expanded configuration should be loaded.
The following is stated in the official README and it is feasible that a configuration file of any name in a subdirectory should also be able to be loaded.
// config.ts
export default {
colors: {
primary: "user_primary",
},
extends: ["./theme", "./config.dev.ts"],
};