panva / openid-client

OAuth 2 / OpenID Connect Client API for JavaScript Runtimes
MIT License
1.83k stars 392 forks source link

webpack: require function is used in a way in which dependencies cannot be statically extracted #242

Closed AbdulHannan96 closed 4 years ago

AbdulHannan96 commented 4 years ago

Describe the bug Getting this warning when I run "npm run build" ./node_modules/got/source/request-as-event-emitter.js 72:18-25 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted @ ./node_modules/got/source/as-promise.js @ ./node_modules/got/source/create.js @ ./node_modules/got/source/index.js @ ./node_modules/openid-client/lib/helpers/request.js @ ./node_modules/openid-client/lib/index.js @ ./lib/***.js @ ./lib/main.js @ multi ./lib/main.js

Steps to reproduce the behaviour:

  1. Install Package
  2. Run npm run build

Expected behaviour No warnings

Environment:

panva commented 4 years ago

@AbdulHannan96 I have absolutely zero clue what your npm run build script does.

panva commented 4 years ago

If i'm to guess, you're running webpack, in which case - don't apply webpack on dependencies. It's mostly not supported and in the case of the only supported js runtime of this library being Node.js, not necessary.

If you're hoping to transpile this and use it in a browser based app, bad luck, this ain't a package that supports that.