Categories
JavaScript Answers

How to fix Webpack 4 “size exceeds the recommended limit (244 KiB)” error with JavaScript?

Spread the love

To fix Webpack 4 "size exceeds the recommended limit (244 KiB)" error with JavaScript, we set devtool to false.

For instance, in webpack.config.js, we write

const mode = process.env.NODE_ENV || "development";
module.exports = {
  //...
  devtool: mode === "development" ? "inline-source-map" : false,
  mode,
  //...
};

to set devtool to false is mode isn’t 'development'.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *