Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next export adds all hot-update files #5554

Closed
iamstarkov opened this issue Oct 30, 2018 · 4 comments · Fixed by #26066 · May be fixed by ajesse11x/next.js#1090 or adamlaska/next.js#759
Closed

next export adds all hot-update files #5554

iamstarkov opened this issue Oct 30, 2018 · 4 comments · Fixed by #26066 · May be fixed by ajesse11x/next.js#1090 or adamlaska/next.js#759
Labels
good first issue Easy to fix issues, good for newcomers

Comments

@iamstarkov
Copy link

iamstarkov commented Oct 30, 2018

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
@iamstarkov
Copy link
Author

Workaround is to adjust export script:

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

@andersonleite
Copy link
Contributor

PR
#6003

@timneutkens
Copy link
Member

Closing this in favor of #6009

kodiakhq bot pushed a commit that referenced this issue Jun 14, 2021
- Enables excludeDefaultMomentLocales by default
- Adds distDir cleaning (See RFC #6009)
- Adds support for `PORT`
- Removes `router.events` from the server-side router as it should not be used server-side (long-standing todo that is potentially breaking). Note that it's still available as `Router.events` (import Router from 'next/router') and with `useRouter` in `useEffect`. Using it with `useEffect` is the correct way and I've updated the upgrading guide to reflect that
- Added webpack 5 to the upgrading guide
- Removed `Head.rewind` as it's been a no-op since Next.js 9.5 and can now be safely removed from user code

Fixes #11408 
Fixes #10338
Fixes #5554



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
flybayer pushed a commit to blitz-js/next.js that referenced this issue Jun 16, 2021
- Enables excludeDefaultMomentLocales by default
- Adds distDir cleaning (See RFC vercel#6009)
- Adds support for `PORT`
- Removes `router.events` from the server-side router as it should not be used server-side (long-standing todo that is potentially breaking). Note that it's still available as `Router.events` (import Router from 'next/router') and with `useRouter` in `useEffect`. Using it with `useEffect` is the correct way and I've updated the upgrading guide to reflect that
- Added webpack 5 to the upgrading guide
- Removed `Head.rewind` as it's been a no-op since Next.js 9.5 and can now be safely removed from user code

Fixes vercel#11408 
Fixes vercel#10338
Fixes vercel#5554



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.