all in a title; details are below
if you develop next.js site for awhile and then run next export in the out folder you will get a lot of hot-update files in an out folder, which are required only for development and redundant for prod
That makes now deployment pretty slow, I unexpectedly got 248 files to deploy for my next-js based version of a blog.
curl https://codeload.github.com/zeit/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/basic-export
cd basic-export/
atom . # or vim .
yarn
yarn dev
# open http://localhost:3000
# change ./pages/index.js few times
# make sure to get few hot updates
# stop
yarn build
yarn export
tree out/ | grep hot
tree out/ | grep hot | wc -l # 16
~/projects/oss
โฏ curl https://codeload.github.com/zeit/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/basic-export
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1766k 0 1766k 0 0 849k 0 --:--:-- 0:00:02 --:--:-- 849k
~/projects/oss
โฏ cd basic-export/
~/projects/oss/basic-export
โฏ atom .
~/projects/oss/basic-export
โฏ yarn
yarn install v1.9.4
info No lockfile found.
[1/4] ๐ Resolving packages...
[2/4] ๐ Fetching packages...
[3/4] ๐ Linking dependencies...
[4/4] ๐ Building fresh packages...
success Saved lockfile.
โจ Done in 15.50s.
~/projects/oss/basic-export
โฏ yarn dev
yarn run v1.9.4
$ next
โ success server compiled in 163ms
โ success client compiled in 838ms
DONE Compiled successfully in 1658ms 16:06:03
> Ready on http://localhost:3000
WAIT Compiling... 16:06:03
โ success client compiled in 64ms
DONE Compiled successfully in 122ms 16:06:03
> Building page: /
WAIT Compiling... 16:06:46
โ success server compiled in 1s 190ms
โ success client compiled in 1s 344ms
DONE Compiled successfully in 1377ms 16:06:48
WAIT Compiling... 16:07:27
โ success server compiled in 236ms
โ success client compiled in 224ms
DONE Compiled successfully in 304ms 16:07:27
WAIT Compiling... 16:07:31
โ success client compiled in 164ms
DONE Compiled successfully in 192ms 16:07:32
โ success server compiled in 227ms
WAIT Compiling... 16:07:37
โ success client compiled in 124ms
DONE Compiled successfully in 154ms 16:07:37
โ success server compiled in 198ms
WAIT Compiling... 16:07:38
โ success client compiled in 200ms
DONE Compiled successfully in 225ms 16:07:39
โ success server compiled in 263ms
WAIT Compiling... 16:07:40
โ success client compiled in 195ms
DONE Compiled successfully in 220ms 16:07:40
โ success server compiled in 265ms
^C
got signal SIGINT, exiting
~/projects/oss/basic-export
โฏ yarn build
yarn run v1.9.4
$ next build
[16:08:18] Compiling client
[16:08:18] Compiling server
[16:08:19] Compiled server in 969ms
[16:08:23] Compiled client in 5s
โจ Done in 7.03s.
~/projects/oss/basic-export
โฏ yarn export
yarn run v1.9.4
$ next export
> using build directory: /Users/vlasta/projects/oss/basic-export/.next
copying "static build" directory
> No "exportPathMap" found in "next.config.js". Generating map from "./pages"
> exporting path: /about
> exporting path: /about2
> exporting path: /day
> exporting path: /index
> exporting path: /404
> exporting path: /
Export successful
โจ Done in 0.64s.
~/projects/oss/basic-export
โฏ tree out/ | grep hot
โ โโโ 23406fc088aa2cd5d5cc.hot-update.json
โ โโโ 63ab2713fe0a0c0ca18a.hot-update.json
โ โโโ 8a557812ce01101491df.hot-update.json
โ โโโ 9fba8f1c8050faa909b4.hot-update.json
โ โโโ a06dadb8d20686abb97f.hot-update.json
โ โโโ b2b8fb449294bf75a044.hot-update.json
โ โโโ index.js.23406fc088aa2cd5d5cc.hot-update.js
โ โโโ index.js.23406fc088aa2cd5d5cc.hot-update.js.map
โ โโโ index.js.63ab2713fe0a0c0ca18a.hot-update.js
โ โโโ index.js.63ab2713fe0a0c0ca18a.hot-update.js.map
โ โโโ index.js.8a557812ce01101491df.hot-update.js
โ โโโ index.js.8a557812ce01101491df.hot-update.js.map
โ โโโ index.js.9fba8f1c8050faa909b4.hot-update.js
โ โโโ index.js.9fba8f1c8050faa909b4.hot-update.js.map
โ โโโ index.js.b2b8fb449294bf75a044.hot-update.js
โ โโโ index.js.b2b8fb449294bf75a044.hot-update.js.map
~/projects/oss/basic-export
โฏ tree out/ | grep hot | wc -l
16
out folder should not have dev-only files, like hot-update files

10.14 (18A391)7.0.2Workaround is to adjust export script:
// package.json
scripts: {
"export": "rm -rf .next out && next build && next export"
}
Closing this in favor of #6009
Most helpful comment
Workaround is to adjust export script: