Skip to content

Instantly share code, notes, and snippets.

@jeremyckahn
Last active April 11, 2018 15:44
Show Gist options
  • Save jeremyckahn/04f3e7bd0d0bdaefacc2df2f213a25be to your computer and use it in GitHub Desktop.
Save jeremyckahn/04f3e7bd0d0bdaefacc2df2f213a25be to your computer and use it in GitHub Desktop.
Add this to your JS project to easily see what's in your Webpack binary!
diff --git a/package.json b/package.json
index 8a5e292..c85b9ea 100644
--- a/package.json
+++ b/package.json
@@ -4,4 +4,5 @@
"scripts": {
"build": "webpack --config webpack.config.js --mode production",
+ "build:analyze": "webpack --config webpack.config.js --mode production --profile --json > /tmp/webpack-stats.json; webpack-bundle-analyzer /tmp/webpack-stats.json",
"lint": "eslint --ext .js --ext .jsx . && echo \"No lint errors!\"",
"prettier": "prettier --single-quote --trailing-comma es5 '{src,test}/**/*.js' --write",
@@ -59,4 +60,5 @@
"style-loader": "^0.13.2",
"webpack": "^4.5.0",
+ "webpack-bundle-analyzer": "^2.11.1",
"webpack-cli": "^2.0.14",
"webpack-dev-server": "^3.1.3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment