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 !` with `new Method` usage

See original GitHub issue

Bug report

What is the current behavior? Fails with an expection

If the current behavior is a bug, please provide the steps to reproduce.

import Method from 'path/to/unexisting/module';
new Method();

It will be transpiled to

new !(function webpackMissingModule() { var e = new Error("Cannot find module 'path/to/unexisting/module'"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(params);

What is the expected behavior? Proper exception with proper error message and stack.

Other relevant information: webpack version: 4.19.1 Node.js version: v10.13.0 Operating System: MacOS

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
extemplcommented, Sep 19, 2019

@ajaygangarde as a workaround - just click on the link to the code place where the exception happened and you’ll see the exact missing path in the generated code.

0reactions
alexander-akaitcommented, Feb 26, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

SyntaxError: Unexpected token - JavaScript - MDN Web Docs
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided.
Read more >
SyntaxError: Unexpected token in JavaScript | bobbyhadz
The "Uncaught SyntaxError: Unexpected token" occurs for multiple reasons: · The error is also caused if you're making an HTTP request to a...
Read more >
Uncaught SyntaxError: Unexpected token : - Stack Overflow
"Uncaught SyntaxError: Unexpected token" error appearance when your data return wrong json format, in some case, you don't know you got wrong json...
Read more >
Uncaught SyntaxError: Unexpected token < - JavaScript - iDiallo
All it means is that the interpreter is expecting JavaScript or JSON and you are feeding it HTML/XML. If you don't think you...
Read more >
[Support Guide] Why do I see “Uncaught SyntaxError ...
The error Uncaught SyntaxError: Unexpected token < is most commonly caused by your site's code referring to an asset that is no longer...
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