Babel: Module Parse failed (Likely due to import meta)

Viewed 247

I currently building an app with create-react-app, and ive been running into alot of errors with Babel. I currently have the following error:

./node_modules/scrambles/dist/esm/scrambles.js 500:65
Module parse failed: Unexpected token (500:65)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| }
| 
> outsideStrategy.url.esm = new URL("./scrambles-worker.js", import.meta.url);
| outsideStrategy.getNodeAdapter.esm = getNodeAdapterESM;
| outsideStrategy.getWorkerConstructor.browser = workerConstructorBrowser;

Here is my package.json file:

{
  "name": "react-timer",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.12.0",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "@types/node": "^15.3.0",
    "bulma": "^0.9.2",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-icons": "^4.2.0",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.1",
    "scrambles": "^0.1.13",
    "typescript": "^4.2.4",
    "web-vitals": "^1.1.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": [
    "defaults"
  ]
}

Im currently under the impression that there is an issue with the Babel plugin responsible for taking care of import.meta.url, however to be honest I really know next to nothing about Babel (Ive just started with JS moving from a Python background). Is this a known bug? Any suggestions are appreciated.

0 Answers
Related