danestves / lite-embed

Embed YouTube and Vimeo without hustle. Components that are quick, light, and reusable.

Home Page:https://lite-embed.vercel.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not working in Next 12.2.5

briannelson95 opened this issue · comments

I see that this was close but I'm still getting this error with Next. Was there a fix? If so what was the fix?

Originally posted by @briannelson95 in #80 (comment)

Here is a replica of this issue
https://stackblitz.com/edit/nextjs-f4cr36?file=pages/index.js

image

I have the same problem - I tried hacking with webpack's config following a suggestion I found somewhere, but this didn't really get me anywhere:

const nextConfig = {
  reactStrictMode: true,
  
  webpack:  (
    config,
    { buildId, dev, isServer, defaultLoaders, nextRuntime, webpack }
  ) => {
    config.externals = [
      "child_process",
      "dns",
      "fs",
      "net",
      "tls",
      "http2"
    ]
    config.resolve.fallback = {
      url: require.resolve("url"),
      fs: require.resolve("graceful-fs"),
      buffer: require.resolve("buffer"),
      stream: require.resolve("stream-browserify"),
  };
  config.plugins.push(
      new webpack.ProvidePlugin({
          process: "process/browser",
          Buffer: ["buffer", "Buffer"],
      }),
      new webpack.NormalModuleReplacementPlugin(/node:/, (resource) => {
          const mod = resource.request.replace(/^node:/, "");
          switch (mod) {
              case "buffer":
                  resource.request = "buffer";
                  break;
              case "stream":
                  resource.request = "readable-stream";
                  break;
              default:
                  throw new Error(`Not found ${mod}`);
          }
      }),
  );
  config.ignoreWarnings = [/Failed to parse source map/];

    return config
  }, 
    
  
}

module.exports = nextConfig

I closed the other issue because there was no response for a reproduction, I'm investigating the issue and without any fix for now. Trying to hack some things inside next.js but with the same result, as soon as I get any fix will post it here!

Sorry for the troubles!

Hello! A quick update, this weekend I'm going to work on this package now that I have more time and fix the related issues 🙌

commented

I got an similar issue in next 13.2.4 (current major version)

Bildschirmfoto am 2023-03-28 um 11 56 31