-
I'm using
I believe it's because the __exportStar(require("./runtime"), exports);
__exportStar(require("./apis"), exports);
__exportStar(require("./models"), exports);
__exportStar(require("./apis/DefaultApi/OperationConfig"), exports); Is there a way to get the TypeSafeApi project to spit out exports like: I tried doing: runtime: {
languages: [Language.TYPESCRIPT],
options: {
typescript: {
name: "cx-api-typescript-runtime",
defaultReleaseBranch: "main",
description:
"Generated typescript packages for our API, from Smithy models",
tsconfig: {
compilerOptions: {
module: "nodenext",
target: "es2022",
},
},
},
},
} but this throws the same error |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
This seems to clear those errors(changing the tsconfig for the TypeSafeApi) tsconfig: {
compilerOptions: {
module: "es2022",
target: "es2022",
moduleResolution: javascript.TypeScriptModuleResolution.NODE,
resolveJsonModule: true,
esModuleInterop: true,
},
} But then the CDK construct/subproject(which deploys the API to a lambda) throws an error:
|
Beta Was this translation helpful? Give feedback.
-
Right so recap:
import { DefaultApi, Configuration } from "my-api-typescript-runtime/src/index"; I have no idea if this is good or bad... |
Beta Was this translation helpful? Give feedback.
Hey! Sorry for the slow reply! Glad you found a combination that solved it! 😄
I've experienced hurt with ESM vs CJS before too haha! You can get both building though instead of just choosing between one or the other if that helps :)
Here's an example of how to do it in your
.projenrc
(courtesy of @zsstiers !):