connectkit: [BUG] Production build is failing with latest version connectkit@1.1.2
Describe the bug
Production build is failing with error ReferenceError: _a is not defined. Tricky to debug, as this is working well on development mode.
This is only happening when I updated my connectkit version to ^1.1.2
To reproduce
Using connectkit and wagmi versions, and client configuration below:
/* package.json */
"connectkit": "^1.1.2",
"wagmi": "^0.10.15"
const client = createClient(
getDefaultClient({
autoConnect: true,
appName: "Test wallet connection",
connectors: [new MetaMaskConnector()]
})
);
Run the production build.
Expected behavior
There should be no issue when running the production build. Again, it is working fine with no issue when ran on development mode.
Screenshots
If applicable, add screenshots to help explain your problem.

Environment details
If applicable, let us know which OS, browser, browser version etc you’re using.
Additional context
As a workaround, I’m temporarily using connectkit@1.1.1 and wagmi@0.10.15
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 7
- Comments: 15 (5 by maintainers)
Commits related to this issue
- Pin connectKit to v1.1.1: https://github.com/family/connectkit/issues/89 — committed to MetaFactoryAI/mf-app by META-DREAMER a year ago
- Pin connectKit to v1.1.1: https://github.com/family/connectkit/issues/89 — committed to MetaFactoryAI/mf-app by META-DREAMER a year ago
Hey everyone, we believe that ConnectKit version
1.1.2has an issue with Next 13, which we’re looking into fixing immediately. If anyone here is not using Next 13 please let us know as this will help us debug this error.Looks like our dev and prod rollup configs were mismatched, where prod had Terser set up which has issues with
swcMinify: true. We didn’t catch this because previous builds weren’t having any issues up until now where the latest update has some new patterns that we weren’t using previously, which Terser doesn’t seem to compress properly, and our build tests also didn’t pick this up runtime issue.I’ve opened PR https://github.com/family/connectkit/pull/94 which should resolve this issue, just waiting on some internal reviews before moving forward. Thanks for holding tight, hoping to have the npm package resolved soon!
@lochie Thanks for the update. Confirm that with
swcMinify: falsein next config everything works just fine. Project setting isconnectkit@1.1.2+wagmi@0.10.15+next@13.1.5. Looking forward to fix so that I can use swc minifierThanks for catching this issue @lykalabrada, we also have the same problem with deployment. Will be waiting for a fix.
Great news, thanks! Now waiting for updating peerDependency to
wagmi@0.11.x😃Hey all! We’ve pushed a version of ConnectKit that is now compatible with Nextjs 13’s default configuration. Please upgrade to ConnectKit version
1.1.3and let us know if you have any further issues, thanks!Just a quick update while we continue investigating the issue:
We’ve found that
swcMinify: truein Next 13 is causing us some issues. If you wish to use the new features in ConnectKit1.1.2right now a quick workaround might be to set this tofalsein your Next config. If this doesn’t resolve the issue please let us know so we know to dive deeper into finding the root cause of this problem.Thanks everyone for letting us know they’re having similar issues, we appreciate everyones contribution to keeping ConnectKit awesome 🫡 We’re still investigating further and we will keep this thread updated as we find more information to resolve this issue properly.
@alagunoff, fortunately I have no issues on production build when using
connectkit@1.1.1+wagmi@0.10.15combinationIt’s impossible to work well on development. Probably, you have package lock or yarn lock present and no upgrade was performed. If you manually yarn add wagmi@latest and conneckit@latest and run yarn dev, your dev build will also fail.