Skip to content

Commit

Permalink
Turbopack: fix over-invalidation of node.js assets (#57240)
Browse files Browse the repository at this point in the history
### What?

* no need to clear require cache when assets where not used previously
* make build status reporting more consistent
* report build status to client side for build indicator

### Why?

### How?


Closes WEB-1826
  • Loading branch information
sokra authored Oct 23, 2023
1 parent 6adb971 commit c2ba7e6
Show file tree
Hide file tree
Showing 4 changed files with 263 additions and 212 deletions.
1 change: 1 addition & 0 deletions packages/next/src/client/dev/dev-build-watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export default function initializeBuildWatcher(
break
case HMR_ACTIONS_SENT_TO_BROWSER.BUILT:
case HMR_ACTIONS_SENT_TO_BROWSER.SYNC:
case HMR_ACTIONS_SENT_TO_BROWSER.FINISH_BUILDING:
hide()
break
}
Expand Down
6 changes: 6 additions & 0 deletions packages/next/src/server/dev/hot-reloader-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const enum HMR_ACTIONS_SENT_TO_BROWSER {
SYNC = 'sync',
BUILT = 'built',
BUILDING = 'building',
FINISH_BUILDING = 'finishBuilding',
DEV_PAGES_MANIFEST_UPDATE = 'devPagesManifestUpdate',
TURBOPACK_MESSAGE = 'turbopack-message',
SERVER_ERROR = 'serverError',
Expand All @@ -37,6 +38,10 @@ interface BuildingAction {
action: HMR_ACTIONS_SENT_TO_BROWSER.BUILDING
}

interface FinishBuildingAction {
action: HMR_ACTIONS_SENT_TO_BROWSER.FINISH_BUILDING
}

interface SyncAction {
action: HMR_ACTIONS_SENT_TO_BROWSER.SYNC
hash: string
Expand Down Expand Up @@ -95,6 +100,7 @@ export type HMR_ACTION_TYPES =
| TurbopackMessageAction
| TurbopackConnectedAction
| BuildingAction
| FinishBuildingAction
| SyncAction
| BuiltAction
| AddedPageAction
Expand Down
Loading

0 comments on commit c2ba7e6

Please sign in to comment.