TypeError: require is not a function (webpack + faunadb)

June 29, 20171 minute

This error comes up when using faunadb’s driver for nodejs with webpack.

Adding the following to webpack.config.js fixed the issue:

plugins: [
  new webpack.DefinePlugin({ "global.GENTLY": false })
node: {
  __dirname: true,
alias: {
  'inherits': 'inherits/inherits_browser.js',
  'superagent': 'superagent/lib/client',
  'emitter': 'component-emitter',

Here’s the issue and fix:

Tweet this post
© 2021 Dan Bruder