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.

Version 7.0.0 is not working and build is failing: Module parse failed: Unexpected token

See original GitHub issue
Bug Report or Feature Request (mark with an x)
- [x] Regression (a behavior that used to work and stopped working in a new release)
- [ ] Bug report -> please search issues before submitting
- [ ] Feature request
- [ ] Documentation issue or request

I simply installed the new version 7.0.0 and it seems not working at all, the project is failing to start and building it is not working as well:

2021-05-20T11:25:49.5703195Z Error: ./node_modules/pdfjs-dist/build/pdf.js 2413:45
2021-05-20T11:25:49.5703782Z Module parse failed: Unexpected token (2413:45)
2021-05-20T11:25:49.5704250Z File was processed with these loaders:
2021-05-20T11:25:49.5705115Z  * ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
2021-05-20T11:25:49.5706163Z  * ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js
2021-05-20T11:25:49.5706735Z  * ./node_modules/@ngtools/webpack/src/ivy/index.js
2021-05-20T11:25:49.5707224Z You may need an additional loader to handle the result of these loaders.
2021-05-20T11:25:49.5707863Z |         intent: renderingIntent,
2021-05-20T11:25:49.5708327Z |         renderInteractiveForms: renderInteractiveForms === true,
2021-05-20T11:25:49.5708950Z >         annotationStorage: annotationStorage?.getAll() || null
2021-05-20T11:25:49.5709375Z |       });
2021-05-20T11:25:49.5709658Z |     }
2021-05-20T11:25:49.5711223Z  @ ./node_modules/ng2-pdf-viewer/__ivy_ngcc__/fesm2015/ng2-pdf-viewer.js 4:0-36 154:11-16 154:31-51 167:36-41 168:50-63 204:74-87 206:19-44 274:27-43 276:27-43 278:27-43 280:27-43 282:27-43 417:19-24 465:19-24 549:31-48
2021-05-20T11:25:49.5714018Z  @ ./src/app/components/widgets/widgets.module.ts
2021-05-20T11:25:49.5714613Z  @ ./src/app/app.module.ts
2021-05-20T11:25:49.5714940Z  @ ./src/main.ts
2021-05-20T11:25:49.5715485Z  @ multi ./src/main.ts
2021-05-20T11:25:49.5715656Z 
2021-05-20T11:25:49.5716494Z Error: ./node_modules/pdfjs-dist/web/pdf_viewer.js 895:20
2021-05-20T11:25:49.5716998Z Module parse failed: Unexpected token (895:20)
2021-05-20T11:25:49.5717527Z File was processed with these loaders:
2021-05-20T11:25:49.5718356Z  * ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
2021-05-20T11:25:49.5719558Z  * ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js
2021-05-20T11:25:49.5720177Z  * ./node_modules/@ngtools/webpack/src/ivy/index.js
2021-05-20T11:25:49.5720667Z You may need an additional loader to handle the result of these loaders.
2021-05-20T11:25:49.5721137Z |     this._on(eventName, listener, {
2021-05-20T11:25:49.5721568Z |       external: true,
2021-05-20T11:25:49.5721935Z >       once: options?.once
2021-05-20T11:25:49.5722257Z |     });
2021-05-20T11:25:49.5722549Z |   }
2021-05-20T11:25:49.5723613Z  @ ./node_modules/ng2-pdf-viewer/__ivy_ngcc__/fesm2015/ng2-pdf-viewer.js 5:0-57 418:44-55 445:47-73 446:50-79 460:42-63 466:44-55 489:48-74 490:51-80 504:43-74
2021-05-20T11:25:49.5724455Z  @ ./src/app/components/widgets/widgets.module.ts
2021-05-20T11:25:49.5724868Z  @ ./src/app/app.module.ts
2021-05-20T11:25:49.5725179Z  @ ./src/main.ts
2021-05-20T11:25:49.5725563Z  @ multi ./src/main.ts
[ng] Error: ./node_modules/pdfjs-dist/build/pdf.js 2413:45
[ng] Module parse failed: Unexpected token (2413:45)
[ng] File was processed with these loaders:
[ng]  * ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
[ng]  * ./node_modules/@ngtools/webpack/src/ivy/index.js
[ng] You may need an additional loader to handle the result of these loaders.
[ng] |         intent: renderingIntent,
[ng] |         renderInteractiveForms: renderInteractiveForms === true,
[ng] >         annotationStorage: annotationStorage?.getAll() || null
[ng] |       });
[ng] |     }
[ng] Error: ./node_modules/pdfjs-dist/web/pdf_viewer.js 895:20
[ng] Module parse failed: Unexpected token (895:20)
[ng] File was processed with these loaders:
[ng]  * ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
[ng]  * ./node_modules/@ngtools/webpack/src/ivy/index.js
[ng] You may need an additional loader to handle the result of these loaders.
[ng] |     this._on(eventName, listener, {
[ng] |       external: true,
[ng] >       once: options?.once
[ng] |     });
[ng] |   }

I removed the node_module folder and installed it again but with no luck.

I’m not sure what is happening with this project but we are getting a lot of issues recently, you maybe need a sample project or tests to do before releasing it.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
arturovtcommented, May 20, 2021

That was my mistake since I changed module imports to import non-es5 bundles. I didn’t know that they’re using the latest features, especially inside the JavaScript.

That also might be fixable by installing the custom-webpack and adding Babel optional chaining preset, but that’s not our case 😄

1reaction
arturovtcommented, May 20, 2021

I’ll have a look this evening.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module Parse Failed: Unexpected Token · Issue #76 - GitHub
I'm trying to add the @mxenabled/web-widget-sdk into a React app. I was able to install the sdk and it looks like I was...
Read more >
Module parse failed: Unexpected token - Stack Overflow
Apparently it happened because you have two module properties in the webpack config object. Given JS objects can only hold one value per...
Read more >
[Help] Module parse failed: Unexpected token . Babel not ...
I got no errors with stable_6433, but we're building features branching from stable. My babel.config.js stays the same with 6433 and not using...
Read more >
r/reactjs - Reddit
Module parse failed : Unexpected token i in JSON at position 16 while parsing near You may need an appropriate loader to handle...
Read more >
Firebase JavaScript SDK Release Notes - Google
Fixed timer issues in the App Check SDK that caused the token to fail to refresh ... Added the missing CDN build and...
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