Unexpected token import with nextjs
See original GitHub issueGot this error when using with nextjs.
/sandbox/node_modules/swiper/dist/js/swiper.esm.js:13
import { $, addClass, removeClass, hasClass, toggleClass, attr, removeAttr, data, transform, transition as transition$1, on, off, trigger, transitionEnd as transitionEnd$1, outerWidth, outerHeight, offset, css, each, html, text, is, index, eq, append, prepend, next, nextAll, prev, prevAll, parent, parents, closest, find, children, remove, add, styles } from 'dom7/dist/dom7.modular';
^^^^^^
SyntaxError: Unexpected token import
Here’s the sandbox: https://codesandbox.io/s/k29xjy98j3?fontsize=14
Issue Analytics
- State:
- Created 5 years ago
- Reactions:12
- Comments:20 (4 by maintainers)
Top Results From Across the Web
Next.js SyntaxError "Unexpected token 'export'" - Stack Overflow
So the dependency in node_modules folder exports a function using ES6 import/export module. The code will throw error when it running in ...
Read more >SyntaxError: Unexpected token { when importing an npm ...
I've imported it in a react-app and it works perfectly fine with no syntaxError so I assume nextjs app is missing something that...
Read more >[Solved] SyntaxError: Unexpected token '.' Jest Error for Next.js ...
This error could be caused by a number of issues and is related to Jest wanting to process CommonJS code. But it is...
Read more >Fixing "SyntaxError: Unexpected token 'export'" with NextJS
Fixing “SyntaxError: Unexpected token ”export”” with NextJS. I ran into an error when trying to use reactgrid with NextJS. The error was
Read more >Error compiling on code that didn't change : r/nextjs - Reddit
pages/_app.tsx:3:12 Syntax error: Unexpected token, expected "from" 1 | import { config } from "@fortawesome/fontawesome-svg-core"; ...
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 FreeTop 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
Top GitHub Comments
@all, I released
2.1.1
which support full version. You can import full version byreact-id-swiper/lib/ReactIdSwiper.full
@kidjp85 I’m trying to use next-transpile-modules but this is the error now…
my next.config.js looks like this