Closed
Description
Noticed what might be a small footgun for people forking react-scripts to create their own.
I was almost done setting up my custom react-scripts fork when I got this error:
/home/dano/src/ctrlpanel-ts/src/react-app-env.d.ts
Type error: Cannot find type definition file for 'react-scripts'. TS2688
> 1 | /// <reference types="react-scripts" />
| ^
2 |
The problem was fixed in my project by changing the types string in react-app-env.d.ts
to match the name of my react-sripts package. (e.g. "react-scripts"
-> "@company/react-scripts"
)
After some sleuthing, I found out that, although custom script names are handled in config/paths.js
by using ownPackageJson.name
, it's hardcoded in verifyTypeScriptSetup.js
// Reference `react-scripts` types
if (!fs.existsSync(paths.appTypeDeclarations)) {
fs.writeFileSync(
paths.appTypeDeclarations,
`/// <reference types="react-scripts" />${os.EOL}`
);
}
Perhaps this should be modified to check the package.json for a name?
Metadata
Metadata
Assignees
Labels
No labels