widgets
widgets copied to clipboard
Error occurred in Nextjs 15
Bug Description When integrating the Uniswap widget in Next.js 15, the following error occurs: Module not found: Can't resolve 'fs' This issue happens because the widget tries to use the Node.js fs module, which is not available in the browser environment. The integration works fine in Next.js 14, but fails in Next.js 15 due to changes in module handling or polyfills.
Versions
next: ^15.1.3 react: ^19.0.0 typescript: ^5.7.2 @uniswap/widgets": 2.18.0,
Expected Behavior The Uniswap widget should integrate seamlessly in Next.js 15, without any errors related to the fs module. The widget should function as expected in both server-side and client-side environments, similar to its behavior in Next.js 14.
Additional Context The error occurs specifically when using the Uniswap widget in Next.js 15, where the widget attempts to use the fs (file system) module, which is not available in a browser context. This behavior was not present in Next.js 14, where the integration worked without issues. The difference could be related to changes in how Next.js 15 handles or polyfills Node.js-specific modules for client-side code. This issue may affect other packages relying on server-side Node.js modules in client-side code.
this is code of uniswap wedget
I get the same error in both Next 14 and Next 15.
next: 14.2.21 react: 18.3.1 typescript: 5.5.4 @uniswap/widgets: 2.59.0
same error
next: 14.1.0 react: 18 typescript: 5 @uniswap/widgets: 2.59.0