Giter Site home page Giter Site logo

Comments (7)

jordaaash avatar jordaaash commented on August 28, 2024

Hmm, interesting. What about using the IgnorePlugin for Webpack in the Next.js config to ignore the file, then import it manually?

from wallet-adapter.

IAmConnorWilson avatar IAmConnorWilson commented on August 28, 2024

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);
};

from wallet-adapter.

jordaaash avatar jordaaash commented on August 28, 2024

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

from wallet-adapter.

jordaaash avatar jordaaash commented on August 28, 2024

Since the React UI package is already being transpiled this way, I'll close this issue:
https://github.com/solana-labs/wallet-adapter/blob/2c29262405f971f950563f2ff229c1a7a2ff2582/packages/starter/nextjs-starter/next.config.js#L11

from wallet-adapter.

pakaplace avatar pakaplace commented on August 28, 2024

Wallets is undefined when transpiling those modules. Here's my next config where I'm transpiling the modules.
node_modules/@solana/wallet-adapter-ant-design/lib/WalletModal.js (25:25) @ WalletModal TypeError: Cannot read property 'map' of undefined


/** @type {import('next').NextConfig} */
const withTM = require('next-transpile-modules')([
  '@solana/wallet-adapter-react',
  '@solana/wallet-adapter-base',
  '@solana/wallet-adapter-ant-design',
  '@solana/wallet-adapter-wallets',
  '@solana/wallet-adapter-react',
]);

module.exports = withTM({
  reactStrictMode: true,
  webpack: (config) => {
    config.resolve.fallback = { fs: false, path: false, os: false };
    return config;
  },
});

from wallet-adapter.

jordaaash avatar jordaaash commented on August 28, 2024

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.

from wallet-adapter.

carlosbane avatar carlosbane commented on August 28, 2024

For next 13, sprinkling a little "use client" at the top of the file did it for me :)

from wallet-adapter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.