-
Notifications
You must be signed in to change notification settings - Fork 958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React UI components do not work in Next.js #75
Comments
Hmm, interesting. What about using the IgnorePlugin for Webpack in the Next.js config to ignore the file, then import it manually? |
Wasn't able to get anything going with the ignore plugin or babel but I think this library does the trick https://github.com/martpie/next-transpile-modules added to the next.config.js file: const withTM = require('next-transpile-modules')(['@solana/wallet-adapter-react-ui']);
module.exports = (_, { defaultConfig }) => {
// Next.js config
const nextConfig = {
...defaultConfig,
reactStrictMode: true,
};
return withTM(nextConfig);
}; |
Oh, this is what the Next.js starter project already does: https://github.com/solana-labs/wallet-adapter/blob/2c29262405f971f950563f2ff229c1a7a2ff2582/packages/starter/nextjs-starter/next.config.js#L2 |
Since the React UI package is already being transpiled this way, I'll close this issue: |
|
Please check https://github.com/solana-labs/wallet-adapter/tree/master/packages/starter/example which has a complete example of using every provided UI framework for React with Next.js, and also shows how to import the styles and the Next config setup needed. |
For next 13, sprinkling a little "use client" at the top of the file did it for me :) |
Next.js throws errors when libraries try to import global styling. See the following issue:
vercel/next.js#19936
Looks like there might be a patch on the way in Next but is there any way we can pull this out and have users manually add css file? Open to other suggestions
The text was updated successfully, but these errors were encountered: