A webpack plugin with `limit-size`
npm install limit-size-webpack-plugin> A webpack plugin to detect your file size.



``bash`
$ npm i --save-dev limit-size-webpack-plugin
- Add the limit-size-webpack-plugin to your webpack.config.js:
`diff
const path = require("path");
+ const { LimitSizePlugin } = require("limit-size-webpack-plugin");
module.exports = {
entry: "./index.js",
output: {
path: path.resolve(__dirname, "dist"),
filename: "bundle.js",
},
plugins: [
+ new LimitSizePlugin([
+ {
+ path: path.resolve(__dirname, "dist", "bundle.js"),
+ limit: "200 Kb",
+ gzip: true,
+ },
+ {
+ path: path.resolve(__dirname, "dist", "bundle.js"),
+ limit: "50 b",
+ },
+ ]),
],
};
``
MIT@jared.