question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@babel/runtime -> SyntaxError: Unexpected token export -> helpers/esm/extends

See original GitHub issue

Bug Report

@babel/runtime:

Current Behavior

  export default function _extends() {
  ^^^^^^
  SyntaxError: Unexpected token export
      at Module._compile (internal/modules/cjs/loader.js:721:23)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
      at Module.load (internal/modules/cjs/loader.js:653:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
      at Function.Module._load (internal/modules/cjs/loader.js:585:3)
      at Module.require (internal/modules/cjs/loader.js:690:17)
      at Module.Hook._require.Module.require (/Users/parent/child/node_modules/require-in-the-middle/index.js:80:39)
      at require (internal/modules/cjs/helpers.js:25:18)
      at Object.call (/Users/parent/child/server/webpack:/external "@babel/runtime/helpers/esm/extends":1:18)
      at r (/Users/<abs-path>/parent/child/server/webpack:/webpack/bootstrap:25:22)

Input Code babelrc

{
  "presets": [
    ["env", {
      "targets": {
        "uglify": true,
      },
      "modules": false,
      "useBuiltIns": true
    }],
    "react",
    "stage-1"
  ],
  "env": {
    "test": {
      "presets": [
        "env",
        "react",
        "stage-1"
      ]
    },
    "production": {
      "plugins": [
        "transform-react-remove-prop-types",
      ]
    }
  }
}

Expected behavior/code

Expect no error

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:12
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
mkermani144commented, Oct 19, 2020

Any consistent solution on this?

1reaction
enkicomacommented, Dec 11, 2020

Hi guys,

getting kind of related error using Next.js…

   at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
/sandbox/node_modules/@babel/runtime/helpers/esm/extends.js:1
export default function _extends() {
^^^^^^

here is my sandbox: Sandbox-code

Any view/update on how to fix this? I am kind of stuck for days…

Much appreciated!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected token export @babel/runtime/helpers/esm/extends
webpack - @babel/runtime: SyntaxError: Unexpected token export @babel/runtime/helpers/esm/extends - Stack Overflow. Stack Overflow for Teams – ...
Read more >
syntaxerror unexpected token 'export' typescript - You.com
This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax....
Read more >
How I Fixed The Unexpected Token Error In Jest
I refuse to write my packages with old-skool require() and module.export and all those other aging conventions. It's 2021, dammit. Babel ...
Read more >
SyntaxError: Unexpected token 'export' in JavaScript
To solve the "Uncaught SyntaxError Unexpected token 'export'" error, set the type property to module in your package.json file.
Read more >
Typescript : SyntaxError: Unexpected token 'export'-babel.js
You can fix this by changing to CommonJS, or following the steps outlined in the NodeJS ESM page linked. As for why this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found