Unexpected token when using import()
See original GitHub issueI’m submitting a bug report
Webpack Version: 3.3.0
Babel Core Version: 6.25.0
Babel Loader Version: 7.1.1
Please tell us about your environment: Linux
Current behavior:
Using import
function result in
Module build failed: SyntaxError: Unexpected token, expected {
Expected/desired behavior: Letting webpack handle this.
I read somewhere modules should be disabled for babel, if that’s the case I did not found how. Any insight?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:20 (2 by maintainers)
Top Results From Across the Web
Node.js - SyntaxError: Unexpected token import - Stack Overflow
Seems Node v13.2.0 can't import or import() ES modules as '.js' except when there's a package.json with type: module somewhere above it.
Read more >Unexpected token import Node.js - Reactgo
In this tutorial, we are going to learn about how to resolve the unexpected token import error in Node.js. When we use es6...
Read more >Nodejs Uncaught SyntaxError: Unexpected token import
An unexpected token import occurs when an error message appears in the console while running a web application.
Read more >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 >Error Unexpected token import in nodejs | Edureka Community
I don't understand what is wrong. Node v5.6.0 NPM v3.10.6 The code: function (exports, require, ... at startup (node.js:140:18) at ...
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
I have enabled that plugin in .babelrc but still get the error. Any idea?
You’ll need to enable https://babeljs.io/docs/plugins/syntax-dynamic-import/ The
import()
syntax is still an experimental proposal, so you need to opt-in to Babel’s support for it.