Codegen - No esbuild-runner or ts-node
See original GitHub issueI just tried the new 1.0.0-alpha.1 version and noticed that I can’t get the example working.
$ npx @rtk-query/codegen-openapi openapi.dev.config.ts
npx: installed 64 in 7.95s
Encountered a TypeScript configfile, but neither esbuild-runner nor ts-node are installed.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I am wondering if it has to do with the esbuild-runner and ts-node listed as dev dependencies so npx is not installing them when running in production?
The only way I have been able to get it to work so far is to call the cli directly:
node ./node_modules/@rtk-query/codegen-openapi/lib/bin/cli.js openapi.dev.config.ts
config file:
import { ConfigFile, generateEndpoints } from "@rtk-query/codegen-openapi";
const {
parsed: { OPENAPI_DOCS },
} = require("dotenv").config({ path: "./.env.local" });
const config: ConfigFile = {
schemaFile: OPENAPI_DOCS,
apiFile: "./src/app/example-api.empty.ts",
apiImport: "emptyApi",
outputFile: "./src/app/example-api.generated.ts",
exportName: "api",
hooks: true,
};
export default config;
Issue Analytics
- State:
- Created 2 years ago
- Reactions:12
- Comments:11 (4 by maintainers)
Top Results From Across the Web
esbuild-runner - npm
Super-fast on-the-fly transpilation of modern JS, TypeScript and JSX using esbuild. Latest version: 2.2.2, last published: 2 months ago.
Read more >ts-node on steroids - DEV Community
I just released esbuild-runner. It makes it easy to run arbitrary code or tests without needing to build your whole project.
Read more >jun89920-rtk-query-codegen-openapi - npm package - Snyk
The npm package jun89920-rtk-query-codegen-openapi was scanned for known vulnerabilities and missing license, and no issues were found. Thus the ...
Read more >Error: TSError: Unable to compile TypeScript - Stack Overflow
I had met same issue. First I remove ts-node and typescript from package.json . then, npm install ts-node --save-dev npm install typescript ......
Read more >What does it take to support Node.js ESM? – The Guild
There are workarounds, but nothing actually works in 100% of the possible use-cases (see for example, ts-jest issue), and for that reason, we ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Typescript:
openapi-config.tsbut
upd;
package.jsonworks too
We were able to make it run correctly with these steps
Install ts-node
yarn add ts-node --devAdd a new script on package.json
"api-generate": " npx @rtk-query/codegen-openapi openapi-config.ts"yarn api-generate