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

rtk-codemods: Cannot use import statement outside a module #4168

Closed
karlosos opened this issue Feb 7, 2024 · 1 comment · Fixed by #4169
Closed

rtk-codemods: Cannot use import statement outside a module #4168

karlosos opened this issue Feb 7, 2024 · 1 comment · Fixed by #4169

Comments

@karlosos
Copy link

karlosos commented Feb 7, 2024

When trying to run codemods after upgrading to rtk 2 (based on suggestion from docs) I get:

✗  npx @reduxjs/rtk-codemods createReducerBuilder ./src
(node:121639) 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)
/home/karlosos/.npm/_npx/c7474bb40fa6e968/node_modules/@reduxjs/rtk-codemods/bin/cli.js:2
import { execaSync } from 'execa'
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1153:20)
    at Module._compile (node:internal/modules/cjs/loader:1205:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47

Node.js v20.6.1

Is this a problem with my config?

✗  npm --version
9.8.1
➜  node --version
v20.6.1
@karlosos karlosos changed the title rtk-codemods rtk-codemods: Cannot use import statement outside a module Feb 7, 2024
@EskiMojo14
Copy link
Collaborator

Released a fix - thanks for the report!

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

Successfully merging a pull request may close this issue.

2 participants