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.

Webpack error "Unexpected token"

See original GitHub issue

Hi,

I just cloned and tried to build the starter kit, but there seems to be an error with webpack.

ERROR in ./source/components/hello/index.js Module parse failed: C:.…/source\components\hello\index.js Unexpected token (9:6) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (9:6)

I have tracked down the cause of this to the webpack.config.dev.js and webpack.config.prod.js files. The line that triggers the error is : include: path.join(__dirname, 'source')

As soon as I remove that line (actually replacing it with an exclude of node_modules instead), the projet build and runs perfectly.

Do you have any idea what causes this ?

Thanks!

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gumarmcommented, Apr 26, 2017

@Burgi0101 It should at least be compatible with Windows according to Node’s documentation: https://nodejs.org/api/path.html

@ericelliott I’ll search around if I can find a reason as to why it doesn’t work, if I don’t find anything I’ll send a PR for the workaround!

Thanks for your time guys!

0reactions
Burgi0101commented, Apr 26, 2017

Are we sure that the path module is cross platform compatible?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack Build SyntaxError: Unexpected token - Stack Overflow
Webpack Build SyntaxError: Unexpected token ) ; import React from ; function App ; <div> <h2>Welcome to My new React App</h2> <h3>Date :...
Read more >
"SyntaxError: Unexpected token ." in webpack script · Issue #64
Hello, I have the following configuration: node 10.16.0 electron 3.0.2 webpack 4.20.2 webpack-node-externals 1.7.2 When adding the line ...
Read more >
Syntax Error: Unexpected token while bundling with webpack
Greetings, My question is related to configuration of babel/webpack to be able to use nodeJS modules - and unrelated to K6 as such....
Read more >
Webpack lesson - Uncaught SyntaxError: Unexpected token ...
Why do I get "Uncaught SyntaxError: Unexpected token import"? Compiling works ok. I am doing this lessons https://laracasts.com/series/webpack-for-everyone/ ...
Read more >
Unhandled Runtime Error SyntaxError: Unexpected token ...
Hi All, I have been trying to setup and run the headless setup powered by the Atlas Add-on and it proving rather difficult....
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