I have just created a fresh Ionic ReactJS app! when I open my app in WebStorm IDE it gives me this error. But when I run (ionic serve
) the application it’s working fine.
I have tried this solution in javascript - Must use import to load ES Module .eslintrc.js - Stack Overflow] but not working for me.
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/userionic-react/.eslintrc.js from /Users/bs1007/VS/quizsense-mobile/node_modules/@eslint/eslintrc/dist/eslintrc.cjs not supported.
.eslintrc.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename .eslintrc.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /Users/bs1007/VS/quizsense-mobile/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
Environment:
Ionic:
Ionic CLI : 7.1.1 (/Users/rahadur/.nvm/versions/node/v16.17.0/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/react 7.5.3
Capacitor:
Capacitor CLI : 5.5.1
@capacitor/android : not installed
@capacitor/core : 5.5.1
@capacitor/ios : not installed
Utility:
cordova-res : not installed globally
native-run (update available: 2.0.0) : 1.7.4
System:
NodeJS : v16.17.0 (/Users/bs1007/.nvm/versions/node/v16.17.0/bin/node)
npm : 8.19.1
OS : macOS Unknown