fixing third-party modules in gatsby that require window sync

Change your setWebpackConfig rule to:

actions.setWebpackConfig({
  module: {
    rules: [
      {
        test: /react-waves/,
        use: loaders.null(),
      },
    ],
  },
})

The module rule is a regular expression that matches the folder name in your node_modules to add a null loader when the code is transpiled by webpack, that’s why you need to add just the folder name between slashes (/).

Keep in mind that you may need to omit another dependency that react-waves is using too.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top