简体   繁体   中英

how to reduce Nextjs Static HTML Export Page size?

I am using Nextjs Static HTML Export and it's generating each page (Just HTML Code) with a size of 100kb + on disk.

Is there a way to reduce page size on disk?

You could try using Minify HTML which will remove all the unnecessary whitespace from your code. This might decrease the size by a bit.

I reduced page size by 10X using gzip in build. It increases build time, but result in smaller files. Add this in build command:

&& gzip -k -6 $(find public -type f)

More info on this can be here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM