redux-toolkit icon indicating copy to clipboard operation
redux-toolkit copied to clipboard

fix: unclear error when run cts config without ts-node in rtk-query-codegen-openapi

Open lawvs opened this issue 1 year ago • 8 comments

Related to https://github.com/reduxjs/redux-toolkit/issues/2437 https://github.com/reduxjs/redux-toolkit/pull/2438

When you use cts without ts-node in rtk-query-codegen-openapi, the error message is unclear and difficult to troubleshoot.

Before

(node:56745) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)

/Users/user/project/openapi-config.cts:1
import type { ConfigFile } from '@rtk-query/codegen-openapi'
^^^^^^

SyntaxError: Cannot use import statement outside a module

After

Encountered a TypeScript configfile, but neither esbuild-runner nor ts-node are installed.

lawvs avatar Jun 06 '24 09:06 lawvs