apollographql / apollographql/apollo-tooling

CLI doesn't accept a custom config using --config=theConfig.js

Open
#2,014 0 comments 1 reaction 0 assignees View on GitHub
:hammer: cli
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

**Intended outcome:**

I want to run `apollo client:codegen` with a custom config

**Actual outcome:**

I can't. This is what I get

```
apollo client:codegen --config=src/apollo.config.js --target=typescript

⚠️ It looks like there are 0 files associated with this Apollo Project. This may be because you don't have any files yet, or your includes/excludes fields are configured incorrectly, and Apollo can't find your files. For help configuring Apollo projects, see this guide: https://go.apollo.dev/t/config
```

**How to reproduce the issue:**

1. Clone `https://github.com/alejandronanez/apollo-tooling-issue-sample`
2. Run `npm run gen-types:broken` to see the command failing
3. Run `npm run gen-types` to see the same command succeed - the difference is that this command defaults to use `/apollo.config.js` instead of `/src/apollo.config.js`

![](https://cdn.zappy.app/d35f0280cbab11cd0afb1fd7943ed59c.png)

**Versions**

```
"apollo": "^2.28.3"
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with `apollo client:codegen --config=src/apollo.config.js --target=typescript`, comparing it with the working command from `npm run gen-types`. Inspect how the CLI resolves `src/apollo.config.js` versus `/apollo.config.js`; done means the custom config is loaded and code generation finds the project files.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.