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 import" when running babel-watch

See original GitHub issue

Unfortunately, the issue I mentioned in the PR https://github.com/kmagiera/babel-watch/issues/2 is still present. The command I’m running is:

babel-watch --watch src --watch toolkit/webpack toolkit/webpack/development.js

This is the error I get is:

D:\_repos\universal-dev-toolkit\src\client\views\AppBody\Component.js:1
(function (exports, require, module, __filename, __dirname) { import React from 'react';
                                                              ^^^^^^

SyntaxError: Unexpected token import
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:404:25)
    at Module._extensions..js (module.js:432:10)
    at loader (D:\_repos\universal-dev-toolkit\node_modules\babel-watch\runner.js:14:5)
    at Object.require.extensions.(anonymous function) [as .js] (D:\_repos\universal-dev-toolkit\node_modules\babel-watch\runner.js:22:7)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (AppBody.js:5:1)
    at Module._compile (module.js:425:26)
    at loader (D:\_repos\universal-dev-toolkit\node_modules\babel-watch\runner.js:12:13)
    at Object.require.extensions.(anonymous function) [as .js] (D:\_repos\universal-dev-toolkit\node_modules\babel-watch\runner.js:22:7)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)

See the corresponding PR.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
markotomcommented, Apr 11, 2017

It doesn’t work on OSX

4reactions
fatfatsoncommented, Feb 9, 2018

+1 on Win10

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Unexpected token import" when running babel-watch · Issue #2
I have used the following command: babel-watch --presets es2015 ... "SyntaxError: Unexpected token import" when running babel-watch #6.
Read more >
"unexpected token import" in Nodejs5 and babel?
And tried to run it directly by nodejs since it said import is 'shipping features' and support without any runtime flag (https://nodejs.org/en/docs/es6/), ...
Read more >
[Solved]-babel watch SyntaxError: Unexpected token-Reactjs
It seems that babel now needs some additional plugins to work with react. See the answer in this SO question: babel-loader jsx SyntaxError:...
Read more >
How To Use Import Statements in Nodejs - Better Programming
One of the most common is using import statements in Nodejs files. This leads to a syntax error called Unexpected identifier . Even...
Read more >
Tag: create-react-app - somewhat abstract
import {BrowserRouter, StaticRouter} from "react-router-dom"; ... 2.dbb51963.chunk.js:1 Uncaught SyntaxError: Unexpected token '<.
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