Next js issues
This page addresses the possible errors while setting up the widget in Next js applications
1. Next.js minification issue
When using the widget with Next.js, you may encounter a variable naming conflict error ("n is already declared") if you have swcMinify
enabled. This is due to a minification conflict between Next.js's SWC compiler and the widget's bundled code.
To resolve this issue, disable SWC minification in your next.config.js
:
Note: This is a temporary workaround. We are actively working on resolving this minification conflict in future versions of the widget to ensure full compatibility with Next.js's default settings.
2. Self is not defined or HTMLElement not defined
You may encounter Server Error... ReferenceError: self is not defined in your Next JS app, this is because blockend requires web apis to work and the web apis are not available on the server side when next js renders a page, in order to avoid this you can start by importing the Blockend Widget like below
Last updated
Was this helpful?