Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JEST with Angular SyntaxError: Unexpected token 'export' [duplicate]

ProjectDir\node_modules\lodash-es\lodash.js:10 export { default as add } from './add.js'; ^^^^^^

SyntaxError: Unexpected token 'export' at Runtime.createScriptFromCode (../../node_modules/jest-runtime/build/index.js:1728:14) at Object. (../../node_modules/ng2-charts/fesm2015/ng2-charts.mjs:5:23)

like image 853
IGx95 Avatar asked Sep 07 '25 02:09

IGx95


1 Answers

I managed to solve this error following the link below with some variations, but the way that solved my problem was to add the following configuration to the "jset.config.js" file:

moduleNameMapper: {
  "lodash-es": "lodash",
}

Jest setup "SyntaxError: Unexpected token export"

like image 67
Willian Anselmo - Megazordy Avatar answered Sep 08 '25 16:09

Willian Anselmo - Megazordy