`StaticSite` build seems to be trying to use types...
# help
d
StaticSite
build seems to be trying to use types? • CDK is in the root of the repo. • Frontend (Gatsby) is in
./frontend
• I added this to
tsconfig.json
"exclude": ["./jest.config.js", "./node_modules/**/*", "./build/**/*", "./frontend/**/*"],
t
Can you paste your whole tsconfig?
the only thing I have in my tsconfig is an
include: ["stacks"]
for the one in the root
Yeah I'd remove the
src
in the include
d
but that is where my lambda code is
perhaps the issue is that all my node_modules are getting hosted up to root for frontend? (yarn workspaces)
t
The issue you're running into is a typescript one, I don't know exactly how to fix it but I generally avoid it by having multiple tsconfigs like in this example: https://github.com/serverless-stack/serverless-stack/tree/master/examples/typescript-monorepo
I try not to comingle SST type checking with my actual application code type checking
d
shamefully…. we don;’t use TS on our frontend
its JS wildwest
Not sure it makes sense why I would need to add a tsconfig to my frontend that doesn’t even use TS. I think the immediate issue is that the root node_module folder is NOT just CDK modules since I’ve turned on yarn workspaces and thus all modules from frontend are even being hoisted up to root node_modules …. and so typescript is processing those type files which is where its seeing the react-router types.
@thdxr fixed it by adding “dom” to the tsconfig.json
lib
t
Yeah I was saying to add one to your backend code, not frontend. That error is coming from type checking your lambda code
You're right that it's coming from the hoisting
You might be able to fix this by also removing typeRoots for ./node_modules/@types - I don't think that's needed afaik
d
backend = root = cdk frontend = ./frontend = js
I’m happy with this for now. Until it blows up 😛
Thanks again for the help