wallabyjs / console-ninja

Repository for Console Ninja questions and issues
https://console-ninja.com
Other
378 stars 18 forks source link

Module parse failed: Identifier '_templateObject' has already been declared #249

Open Lee-Jason-Curley opened 9 months ago

Lee-Jason-Curley commented 9 months ago

Issue description or question

I can't run Console Ninja without running into this issue outlined in Stackoverflow post: https://stackoverflow.com/questions/74834358/module-parse-failed-identifier-templateobject-has-already-been-declared

Please note that this has been viewed by 1000+ times. So, it seems to be a persistent issue. My app is using node 18.14.0.

Is there going to be fix anytime soon? As is, Console Ninja is unusable for me. I'm using v1.0.268.

Wallaby diagnostics report

ArtemGovorov commented 9 months ago

We have seen an issue like this before and it was related to Next.js SWC compilation: https://github.com/vercel/next.js/issues/44113. We have added a fix for it in Console Ninja when it was originally reported.

Something must have changed in Next.js since then, so the issue is back and new fix may be required.

Unfortunately, we can't reproduce the issue in a freshly generated npx create-next-app@latest Next.js app. It's possible that some specific next.js setting or dependency of your app is causing it.

Can you please create a sample repo demonstrating the issue, we are happy to take a look and investigate.

xuxucode commented 8 months ago

See sample repo: https://github.com/xuxucode/console-ninja-issue-249/blob/master/app/page.tsx#L12-L14

The critical part is a class with private methods:

// A class with two private methods which have same names. The only difference
// is one of them begins with a underscore.
class Client {
  #privateMethod() { }

  #_privateMethod() { }
}
smcenlly commented 8 months ago

@xuxucode - We can reproduce the same issue in your sample repo with Console Ninja paused, disabled, and when Console Ninja is not installed. The problem in your sample repo is not a problem with Console Ninja, it looks to be a problem with Next.js compilation.

xuxucode commented 8 months ago

@smcenlly Yes, it is related to Next.js, has nothing to do with Console Ninja.

xuxucode commented 8 months ago

I also post the comment at https://github.com/vercel/next.js/issues/44113#issuecomment-1898503310, maybe it should be fixed there.