"SyntaxError: Unexpected token import" when running babel-watch
See original GitHub issueUnfortunately, 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:
- Created 7 years ago
- Reactions:3
- Comments:11 (1 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It doesn’t work on OSX
+1 on Win10