Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

655
Views
ESlint react-native Parsing error: Must use import to load ES Module

I'm currently setting up ESlint for my react-native project but running into an error:

Parsing error: Must use import to load ES Module: /Users/ronnygiezen/source/repos/udemy/react-native/meals/MealsToGo/node_modules/eslint-scope/lib/definition.js
require() of ES modules is not supported.
require() of /Users/ronnygiezen/source/repos/udemy/react-native/meals/MealsToGo/node_modules/eslint-scope/lib/definition.js from /Users/ronnygiezen/source/repos/udemy/react-native/meals/MealsToGo/node_modules/babel-eslint/lib/require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename definition.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/ronnygiezen/source/repos/udemy/react-native/meals/MealsToGo/node_modules/eslint-scope/package.json.

This error occurs on every .js file on the first line of the import statements.

My package.json file:

{
  "name": "mealstogo",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject",
    "lint": "eslint . --ext .js"
  },
  "dependencies": {
    "expo": "~43.0.2",
    "expo-status-bar": "~1.1.0",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "react-native": "0.64.3",
    "react-native-web": "0.17.1"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@react-native-community/eslint-config": "^3.0.1",
    "eslint": "^8.3.0",
    "eslint-plugin-flowtype": "^8.0.3",
    "prettier": "^2.5.0"
  },
  "private": true
}

my .eslintrc file:

{
    "extends": "@react-native-community",
    "rules": {
        "quotes": [2, "double", {"avoidEscape": true}]
    },
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!