rsnext/errors/undefined-webpack-config.md
Jeff Escalante b86a1731e1
Error Message Clarity (#16052)
* make the error message more clear if webpack config comes back undefined

* Update check and add test

* bump

* Update build-output test

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-12-01 15:58:52 -06:00

865 B

Missing webpack config

Why This Error Occurred

The value returned from the custom webpack function in your next.config.js was undefined. This can occur from the initial config value not being returned.

Possible Ways to Fix It

Make sure to return the webpack config from your custom webpack function in your next.config.js

// next.config.js

module.exports = {
  webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
    // Note: we provide webpack above so you should not `require` it
    // Perform customizations to webpack config
    config.plugins.push(new webpack.IgnorePlugin(/\/__tests__\//))

    // Important: return the modified config
    return config
  },
}