Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Aug 30, 2024

Conversation

lawvs
Copy link
Contributor

@lawvs lawvs commented Jun 6, 2024

Related to #2437 #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.

Copy link

codesandbox bot commented Jun 6, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

codesandbox-ci bot commented Jun 6, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 993afd2:

Sandbox Source
@examples-query-react/basic Configuration
@examples-query-react/advanced Configuration
@examples-action-listener/counter Configuration
rtk-esm-cra Configuration

Copy link

netlify bot commented Jun 6, 2024

Deploy Preview for redux-starter-kit-docs ready!

Name Link
🔨 Latest commit 2e6dcf0
🔍 Latest deploy log https://app.netlify.com/sites/redux-starter-kit-docs/deploys/6661836ca26f580008a084eb
😎 Deploy Preview https://deploy-preview-4446--redux-starter-kit-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jun 6, 2024

Deploy Preview for redux-starter-kit-docs ready!

Name Link
🔨 Latest commit b73c040
🔍 Latest deploy log https://app.netlify.com/sites/redux-starter-kit-docs/deploys/66703c53fd08ba0008bc4360
😎 Deploy Preview https://deploy-preview-4446--redux-starter-kit-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@EskiMojo14
Copy link
Collaborator

thanks - for future proofing, could you also add detection of .mts?

Copy link

codesandbox-ci bot commented Jun 6, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 32756db:

Sandbox Source
@examples-query-react/basic Configuration
@examples-query-react/advanced Configuration
@examples-action-listener/counter Configuration
rtk-esm-cra Configuration

@lawvs lawvs changed the title fix: unclear error when run cts config without ts-node fix: unclear error when run cts config without ts-node in rtk-query-codegen-openapi Jun 6, 2024
@lawvs
Copy link
Contributor Author

lawvs commented Jun 7, 2024

thanks - for future proofing, could you also add detection of .mts?

Done!

Copy link

codesandbox-ci bot commented Jun 17, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit b73c040:

Sandbox Source
@examples-query-react/basic Configuration
@examples-query-react/advanced Configuration
@examples-action-listener/counter Configuration
rtk-esm-cra Configuration

lawvs and others added 3 commits June 17, 2024 13:37
Co-authored-by: Asuka Minato <i@asukaminato.eu.org>
Co-authored-by: OverflowCat <overflowcat@gmail.com>
@markerikson markerikson merged commit 37328ca into reduxjs:master Aug 30, 2024
5 checks passed
@markerikson
Copy link
Collaborator

Should be live in https://github.com/reduxjs/redux-toolkit/releases/tag/%40rtk-query%2Fcodegen-openapi%402.0.0-alpha.0 ! Please try it out and let us know if it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants