The app.js in Phoenix 1.6 has almost 1 megabyte

The only extra stuff I use is the Alpine js javascript but that should be like 30 kb, right?

Why is the app.js in priv/static/assets this big?

I have tried to delete this file so it is generated anew, but to no avail.

Here is the screenshot:

Is it in development? If so, maybe it has stuff for debugging, like inline source maps?

1 Like

Yes, in development after doing mix phx.server. Is it normal to be that large? What is the expected size of the final app.js file in a fresh Phx install?

When I remove sourcemap stuff after the line 7816 it gets down to 283 KiB:

Will the production version have only 283 KiB or I need to turn off source maps additionally?

1 Like

You should do a production build of it. IIRC the command is mix assets.deploy in more recent Phoenix versions.

1 Like

A stock phx app will output an app.js file that is ~ 87kb (not yet gzipped) via mix assets.deploy

2 Likes

mix assets.deploy also generates gzipped assets, so ~28k for app.js out of the box gzipped :slight_smile:

5 Likes