D
D
Dmitry Baskakov2020-11-23 14:15:34
Vue.js
Dmitry Baskakov, 2020-11-23 14:15:34

The app.js file weighs 735kb - is it normal?

NPM says that app.js is 735kb, and says it's a lot. And now I look and understand that it's a bit too much, but maybe I'm wrong. So the question is: app.js weighs 735kb - is it normal?

UPD #1
to get at least something filled in stats.json and then start the server:

>>> npx webpack --profile --json --entry ./resources/js/app.js --output-path ./public/js/app.js > stats.json
>>> npx webpack-bundle-analyzer ./stats.json -h 0.0.0.0

the commands were prefixed with "docker-compose exec myapp" because the project is in docker

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Stolyarov, 2020-11-23
@dmitrybascacov

See via https://www.npmjs.com/package/webpack-bundle-analyzer
Usage (as a CLI utility)
You can analyze an existing bundle if you have a webpack stats JSON file.
You can generate it using BundleAnalyzerPlugin with generateStatsFile option set to true or with this simple command:
webpack --profile --json > stats.json
If you're on Windows and using PowerShell, you can generate the stats file with this command to avoid BOM issues:

webpack --profile --json | Out-file 'stats.json' -Encoding OEM

Then you can run the CLI tool.
webpack-bundle-analyzer bundle/output/path/stats.json

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question