ardatan / whatwg-node

Helper packages to create platform agnostic applications and libraries without worrying about the lack of WHATWG support in Node.js
MIT License
156 stars 31 forks source link

Client - Critical dependency warning for @whatwg-node/fetch #1061

Closed akifunal closed 2 months ago

akifunal commented 1 year ago

Describe the bug

I'm using fets client in nextjs app (pages router). When NextJS is compiling pages or running in dev mode, console shows a warning :

../../node_modules/.pnpm/@whatwg-node+fetch@0.9.13/node_modules/@whatwg-node/fetch/dist/node-ponyfill.js
Critical dependency: the request of a dependency is an expression

Expected behavior

Not encounter any warnings or error messages when using fets.

Environment:

sinasab commented 11 months ago

Experiencing similar issue!

belgattitude commented 3 months ago

Same with latest version 0.9.18, nextjs 14.2.3 and 14.2.4 (app-router)

/node_modules/.pnpm/@whatwg-node+fetch@0.9.18/node_modules/@whatwg-node/fetch/dist/node-ponyfill.js
Critical dependency: the request of a dependency is an expression
ardatan commented 3 months ago

You can ignore the warning for now. It shouldn't have any effect for the functionality.

belgattitude commented 3 months ago

Good to know, as our CI fails on warnings during build... a temporary workaround (not ideal) is to tune the webpack in next.config

  webpack: (config, { isServer }) => {
    if (isServer) {
      config.module = {
        ...config.module,
       exprContextCritical: false,
      }
    }

    return config;
  },