Must use import to load ES Module Error in AWS Pipeline

vchaurasia95

Vishal Chaurasia

Posted on June 23, 2022

Must use import to load ES Module Error in AWS Pipeline

Hi Everyone,

I'm pretty new to react. Recently I created a reactjs application using the create-react-app and when I'm trying to build the application on AWS Code Build it shows the following error:

Image description

The Node version is 12 currently, but I have tried running on version 16 & 18 as well but the same error is encountered. Interestingly, when I try to run "npm run build" locally it runs successfully. I have further attached snippets of package.json file below:

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@emotion/react": "^11.9.3",
    "@emotion/styled": "^11.9.3",
    "@fontsource/roboto": "^4.5.7",
    "@mui/icons-material": "^5.8.4",
    "@mui/material": "^5.8.5",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-scripts": "5.0.1",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}
Enter fullscreen mode Exit fullscreen mode

Any help to resolve this issue will be greatly appreciated.

💖 💪 🙅 🚩
vchaurasia95
Vishal Chaurasia

Posted on June 23, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related