Next.js config extensions.
We assume that you already have next
package installed.
-
withEslint
- addseslint-loader
.- usage:
// next.config.js module.exports = withEslint({ disableLintForProd: true, // disables linting process for production build phase eslintOptions: {}, // options for eslint-loader });
- required libs:
eslint
,eslint-loader
,eslint-friendly-formatter
. - download command:
npm i -D eslint-loader eslint-friendly-formatter
- usage:
-
withLodash
- optimizeslodash
dist size usinglodash-webpack-plugin
.- usage:
// next.config.js module.exports = withLodash({ lodashWebpackPluginOptions: {}, // lodash-webpack-plugin options. });
- required libs:
lodash-webpack-plugin
. - download command:
npm i -D lodash-webpack-plugin
- usage:
Combine by compose
functions:
module.exports = compose(
withEslint,
withLodash,
)({
poweredByHeader: false, // pass here all your next config options
eslintOptions: {}, // as well as extensions specific options
});