Everything was working fine before, but one morning I started getting this error. I didn't change anything in the project, I didn't use a new version of Node.js.
I tried absolutely everything - tearing down Node.js completely and reinstalling it, but it didn't solve the problem. The funny thing is that everything works fine in the online IDE.
I know that it happens because of Emotion styled. If I'll remove css in js - everything works.
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Loaded env from C:\Users\user\Downloads\zigi-ui-master\.env
event - compiled client and server successfully in 631 ms (203 modules)
wait - compiling /_error (client and server)...
event - compiled client and server successfully in 93 ms (204 modules)
warn - Fast Refresh had to perform a full reload. Read more: https://nextjs.org/docs/basic-features/fast-refresh#how-it-works
wait - compiling /...
error - ./pages/index.jsx
Module parse failed: Identifier '_templateObject' has already been declared (13:9)
File was processed with these loaders:
* ./node_modules/next/dist/compiled/@next/react-refresh-utils/dist/loader.js
* ./node_modules/next/dist/build/webpack/loaders/next-swc-loader.js
You may need an additional loader to handle the result of these loaders.
| return data;
| }
> function _templateObject() {
| var data = _tagged_template_literal([
| "\n text-align: center;\n justify-content: center;\n"
I ran into this same issue today. I reported it to the Next.js team here: https://github.com/vercel/next.js/issues/44113 However, I now realize that the problem was caused by the VS Code Console Ninja extension, which works by hooking in to the compilation process.
I've filed a report with the Console Ninja folks here: https://github.com/wallabyjs/console-ninja/issues/59 In the meantime, I'd recommend disabling the extension while working with Next.js.
Update: Per the Console Ninja team's response, it looks like the issue actually happens any time Next.js sees an eval statement in the same module as multiple template literals. In my case that eval was injected by Console Ninja, but the problem isn't unique to that extension.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With