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.

Uncaught SyntaxError: Unexpected token export

See original GitHub issue
[x] Bug
[ ] Build issue
[ ] Feature request

Version info

ng --version

Angular CLI: 8.3.4
Node: 10.15.0
OS: darwin x64
Angular: 8.2.6
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.803.4
@angular-devkit/build-angular      0.803.4
@angular-devkit/build-optimizer    0.803.4
@angular-devkit/build-webpack      0.803.4
@angular-devkit/core               8.3.4
@angular-devkit/schematics         8.3.4
@angular/cdk                       8.2.0
@angular/cli                       8.3.4
@angular/flex-layout               8.0.0-beta.27
@angular/http                      7.2.15
@angular/material                  8.2.0
@angular/material-moment-adapter   8.2.0
@ngtools/webpack                   8.3.4
@schematics/angular                8.3.4
@schematics/update                 0.803.4
rxjs                               6.5.3
typescript                         3.4.2
webpack                            4.40.2

package.json (dependencies & devDependencies)

"dependencies": {
  "@angular/animations": "^8.2.6",
  "@angular/cdk": "^8.2.0",
  "@angular/common": "^8.2.6",
  "@angular/compiler": "^8.2.6",
  "@angular/core": "^8.2.6",
  "@angular/flex-layout": "^8.0.0-beta.27",
  "@angular/forms": "^8.2.6",
  "@angular/http": "^7.2.15",
  "@angular/material": "^8.2.0",
  "@angular/material-moment-adapter": "^8.2.0",
  "@angular/platform-browser": "^8.2.6",
  "@angular/platform-browser-dynamic": "^8.2.6",
  "@angular/router": "^8.2.6",
  "@candidosales/material-time-picker": "^2.0.0",
  "@ngrx/effects": "^8.3.0",
  "@ngrx/router-store": "^8.3.0",
  "@ngrx/store": "^8.3.0",
  "@swimlane/ngx-charts": "^12.0.1",
  "bootstrap": "^4.3.1",
  "bowser": "^2.6.1",
  "chart.js": "^2.8.0",
  "cleave.js": "^1.5.3",
  "core-js": "^3.2.1",
  "countup.js-angular2": "^7.3.0",
  "d3": "^5.12.0",
  "font-awesome": "^4.7.0",
  "hammerjs": "^2.0.8",
  "highcharts": "^7.2.0",
  "lodash": "^4.17.15",
  "moment": "^2.24.0",
  "ng-html-util": "2.0.x",
  "ng2-nouislider": "1.5.2",
  "ngrx-store-freeze": "^0.2.4",
  "ngx-cleave-directive": "^1.1.3",
  "ngx-image-cropper": "^1.4.1",
  "nouislider": "^9.0.0",
  "oidc-client": "^1.9.1",
  "rxjs": "^6.5.3",
  "sweetalert2": "8.17.1",
  "terraformer-wkt-parser": "^1.2.0",
  "terser": "4.3.1",
  "tslib": "^1.10.0",
  "web-animations-js": "^2.3.2",
  "zone.js": "^0.10.2"
},
"devDependencies": {
  "@angular-devkit/build-angular": "^0.803.4",
  "@angular-devkit/schematics": "^8.3.4",
  "@angular/cli": "^8.3.4",
  "@angular/compiler-cli": "^8.2.6",
  "@angular/language-service": "^8.2.6",
  "@ngrx/schematics": "^8.3.0",
  "@ngrx/store-devtools": "^8.3.0",
  "@types/googlemaps": "^3.37.6",
  "@types/hammerjs": "^2.0.36",
  "@types/jasmine": "^3.4.0",
  "@types/jasminewd2": "~2.0.6",
  "@types/lodash": "^4.14.138",
  "@types/node": "^12.7.5",
  "codelyzer": "^5.1.0",
  "jasmine-core": "^3.4.0",
  "jasmine-spec-reporter": "^4.2.1",
  "karma": "^4.3.0",
  "karma-chrome-launcher": "^3.1.0",
  "karma-cli": "^2.0.0",
  "karma-coverage-istanbul-reporter": "^2.1.0",
  "karma-jasmine": "^2.0.1",
  "karma-jasmine-html-reporter": "^1.4.2",
  "protractor": "^5.4.2",
  "rxjs-tslint": "^0.1.7",
  "ts-node": "^8.3.0",
  "tslint": "^5.20.0",
  "typescript": "3.4.2",
  "webdriver-manager": "^12.1.6",
  "webpack": "^4.40.2"
}

Description

The last line of the CountUp.js library after bundled into “scripts.js” has this token export:

export { CountUp };

This error came after I upgraded all dependencies in the project including CountUp.js.

The serve and build commands don’t report any error and says the build is ok. It seems the functionality isn’t affected, it is only reported at runtime every time a reload the App while serving the project locally with ng serve, by the way this is almost the first output I get on the console.

I have checked-in the [x] Bug option but not sure of the implications, is only a syntax error after all.

I haven’t tried what happens in production and not sure if it is safe to go to production or if I go back to a previos version. Any suggestion?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
inorganikcommented, Aug 1, 2020

In case anyone runs into this error and finds this issue, here’s some info. It’s caused by ES6 modules… this package was using an es6 packaged version of CountUp.js. In the latest patch, v7.3.2, it imports from a UMD packaged version of CountUp.js which should resolve this error.

0reactions
Sparker73commented, Sep 21, 2019

Oh excellent, it means that when I upgraded the dependency I kept doing that import the old way, my bad. Thanks for the tip, I will close this issue. The page has being evolving from some ugly face thing back in 2017 till now, I have learned a lot in the process. Have a good day and many many thanks for your help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Unexpected Token Export - javascript - Stack Overflow
This error is suggesting that either webpack or babel are not working correctly, as export is only available in ES6, and those modules...
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 >
Unexpected Token Export: A Comprehensive Guide
The “unexpected token export” error occurs because the program's module is incompatible with the program's environment or the user has used the wrong...
Read more >
How to Solve Unexpected Token 'export' Error in JavaScript
To solve the "Uncaught SyntaxError Unexpected token 'export'" error, set the type property to module in your package.json file.
Read more >
How to Fix „Uncaught SyntaxError: Unexpected token 'export
Using type="module" on the <script> tag solved the „Unexpected token export ” error. The browser runs the imported JavaScript without issues.
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