I have created a new CDK stack using:
amplify add custom
When I try to build it, I get the following error:
error TS2688: Cannot find type definition file for 'metro-config'.
The file is in the program because:
Entry point for implicit type library 'metro-config'
There is no reference anywhere in cdk-stack.ts to metro-config
. Everything is per default.
I have metro-config
elsewhere in my repo, but in a different package (Yarn workspace).
I have two workspaces:
- web (Next.js, amplify lives here)
- mobile (React Native, contains metro-config)
Running tsc
from web/amplify/backend/custom/mycdk/
also gives the error above.
My tsconfig.json
:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"strict": false,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"outDir": "build"
}
}
My package.json
:
{
"name": "custom-resource",
"version": "1.0.0",
"description": "",
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@aws-amplify/cli-extensibility-helper": "^3.0.0",
"aws-cdk-lib": "~2.68.0",
"constructs": "^10.0.5"
},
"devDependencies": {
"typescript": "^4.9.5"
}
}
I tried yarn add @types/metro-config
, as well as yarn add metro-config
, and nothing changes. Made various changes to tsconfig.json
and nothing worked, so restored it to default.
I am not using project references. The tsconfig.json
file is the one generated by Amplify.