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.

SyntaxError: Unexpected token \ in compiler.js

See original GitHub issue

I got an error while running webpack. The cause of error seems to be JSON.parse(childCompilation.assets[outputName].source()) in the compiler.js.

webpack.config.js:

    var FaviconsWebpackPlugin = require('favicons-webpack-plugin');
    ...
    plugins: [
      ...
      new FaviconsWebpackPlugin('./client/assets/favicon.png')
    ]

Log:

/Users/lvarayut/Documents/Web development/Projects/relay-fullstack/node_modules/webpack-core/lib/NormalModuleMixin.js:151
                                throw e;
                                ^

SyntaxError: Unexpected token \
    at Object.parse (native)
    at /Users/lvarayut/Documents/Web development/Projects/relay-fullstack/node_modules/favicons-webpack-plugin/lib/compiler.js:83:23
    at Compiler.<anonymous> (/Users/lvarayut/Documents/Web development/Projects/relay-fullstack/node_modules/webpack/lib/Compiler.js:214:10)
    at /Users/lvarayut/Documents/Web development/Projects/relay-fullstack/node_modules/webpack/lib/Compiler.js:403:12
    at Compiler.next (/Users/lvarayut/Documents/Web development/Projects/relay-fullstack/node_modules/tapable/lib/Tapable.js:67:11)
    at Compiler.<anonymous> (/Users/lvarayut/Documents/Web development/Projects/relay-fullstack/node_modules/webpack/lib/CachePlugin.js:40:4)
    at Compiler.applyPluginsAsync (/Users/lvarayut/Documents/Web development/Projects/relay-fullstack/node_modules/tapable/lib/Tapable.js:71:13)
    at Compiler.<anonymous> (/Users/lvarayut/Documents/Web development/Projects/relay-fullstack/node_modules/webpack/lib/Compiler.js:400:9)
    at Compilation.<anonymous> (/Users/lvarayut/Documents/Web development/Projects/relay-fullstack/node_modules/webpack/lib/Compilation.js:577:13)
    at Compilation.applyPluginsAsync (/Users/lvarayut/Documents/Web development/Projects/relay-fullstack/node_modules/tapable/lib/Tapable.js:60:69)
    at Compilation.<anonymous> (/Users/lvarayut/Documents/Web development/Projects/relay-fullstack/node_modules/webpack/lib/Compilation.js:572:10)
    at Compilation.next (/Users/lvarayut/Documents/Web development/Projects/relay-fullstack/node_modules/tapable/lib/Tapable.js:67:11)
    at Compilation.<anonymous> (/Users/lvarayut/Documents/Web development/Projects/relay-fullstack/node_modules/favicons-webpack-plugin/lib/compiler.js:57:7)
    at Compilation.applyPluginsAsync (/Users/lvarayut/Documents/Web development/Projects/relay-fullstack/node_modules/tapable/lib/Tapable.js:71:13)
    at Compilation.<anonymous> (/Users/lvarayut/Documents/Web development/Projects/relay-fullstack/node_modules/webpack/lib/Compilation.js:567:9)
    at Compilation.applyPluginsAsync (/Users/lvarayut/Documents/Web development/Projects/relay-fullstack/node_modules/tapable/lib/Tapable.js:60:69)

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
lvarayutcommented, Apr 27, 2016

I got the exact same result as @leMaik. It seems like the result of childCompilation.assets[outputName].source() has been escaped many times.

1reaction
jantimoncommented, Apr 27, 2016

will be fixed by tomorrow

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 >
Have a JavaScript Unexpected Token Error? Check Your Syntax
This JavaScript error is a subset of the SyntaxError. That means it only appears when attempting to execute code with an extra (or...
Read more >
JavaScript SyntaxError - Unexpected token - GeeksforGeeks
This JavaScript exceptions unexpected token occur if a specific language construct was expected, but anything else is typed mistakenly.
Read more >
Uncaught SyntaxError: Unexpected token : - Stack Overflow
An "unexpected token" is likely some illegal character code. Such a code is likely not to show up when you print to console....
Read more >
How to fix: "SyntaxError: Unexpected token" in JavaScript
One common cause of the SyntaxError: Unexpected token error is a missing semicolon. In JavaScript, semicolons are used to indicate the end ...
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