Next.js: next export adds all hot-update files

Created on 30 Oct 2018  ยท  3Comments  ยท  Source: vercel/next.js

Bug report

all in a title; details are below

Describe the bug

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.

To Reproduce

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
full log

~/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

Expected behavior

out folder should not have dev-only files, like hot-update files

Screenshots

screenshot 2018-10-30 at 4 21 36 pm

System information

  • OS: macOS 10.14 (18A391)
  • Version of Next.js: 7.0.2
good first issue

Most helpful comment

Workaround is to adjust export script:

// package.json
  scripts: {
    "export": "rm -rf .next out && next build && next export"
  }

All 3 comments

Workaround is to adjust export script:

// package.json
  scripts: {
    "export": "rm -rf .next out && next build && next export"
  }

Closing this in favor of #6009

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  ยท  3Comments

havefive picture havefive  ยท  3Comments

formula349 picture formula349  ยท  3Comments

DvirSh picture DvirSh  ยท  3Comments

YarivGilad picture YarivGilad  ยท  3Comments