-
Notifications
You must be signed in to change notification settings - Fork 27.8k
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
Fix HMR for middleware #30791 #31548
Conversation
Co-authored-by: Tobias Koppers <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤯
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is breaking css handling 🤔
This comment has been minimized.
This comment has been minimized.
Failing test suitesCommit: 9f7c4f4 test/integration/middleware/with-eval/test/index.test.js
Expand output● Middleware usage of dynamic code evaluation › dev mode › shows a warning when running code with eval
● Middleware usage of dynamic code evaluation › production mode › should have middleware warning during build
test/integration/server-asset-modules/test/index.test.js
Expand output● serverside asset modules › serverless mode › should enable reading local files in api routes
test/integration/telemetry/test/index.test.js
Expand output● Telemetry CLI › emits telemery for usage of image, script & dynamic
|
This comment has been minimized.
This comment has been minimized.
Stats from current PRDefault Build (Increase detected
|
vercel/next.js canary | javivelasco/next.js fix-30791 | Change | |
---|---|---|---|
buildDuration | 21.8s | 21s | -847ms |
buildDurationCached | 4.1s | 4.2s | |
nodeModulesSize | 338 MB | 338 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | javivelasco/next.js fix-30791 | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 3.808 | 3.564 | -0.24 |
/ avg req/sec | 656.44 | 701.38 | +44.94 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 2.073 | 1.991 | -0.08 |
/error-in-render avg req/sec | 1206.17 | 1255.71 | +49.54 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | javivelasco/next.js fix-30791 | Change | |
---|---|---|---|
450.HASH.js gzip | 179 B | 179 B | ✓ |
framework-HASH.js gzip | 42.2 kB | 42.2 kB | ✓ |
main-HASH.js gzip | 28.3 kB | 28.3 kB | ✓ |
webpack-HASH.js gzip | 1.45 kB | 1.45 kB | ✓ |
Overall change | 72.2 kB | 72.2 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | javivelasco/next.js fix-30791 | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages Overall increase ⚠️
vercel/next.js canary | javivelasco/next.js fix-30791 | Change | |
---|---|---|---|
_app-HASH.js gzip | 1.37 kB | 1.37 kB | ✓ |
_error-HASH.js gzip | 194 B | 194 B | ✓ |
amp-HASH.js gzip | 312 B | 312 B | ✓ |
css-HASH.js gzip | 327 B | 327 B | ✓ |
dynamic-HASH.js gzip | 2.38 kB | 2.38 kB | ✓ |
head-HASH.js gzip | 350 B | 350 B | ✓ |
hooks-HASH.js gzip | 635 B | 635 B | ✓ |
image-HASH.js gzip | 4.44 kB | 4.45 kB | |
index-HASH.js gzip | 263 B | 263 B | ✓ |
link-HASH.js gzip | 1.87 kB | 1.87 kB | ✓ |
routerDirect..HASH.js gzip | 321 B | 321 B | ✓ |
script-HASH.js gzip | 383 B | 383 B | ✓ |
withRouter-HASH.js gzip | 318 B | 318 B | ✓ |
85e02e95b279..7e3.css gzip | 107 B | 107 B | ✓ |
Overall change | 13.3 kB | 13.3 kB |
Client Build Manifests
vercel/next.js canary | javivelasco/next.js fix-30791 | Change | |
---|---|---|---|
_buildManifest.js gzip | 460 B | 460 B | ✓ |
Overall change | 460 B | 460 B | ✓ |
Rendered Page Sizes
vercel/next.js canary | javivelasco/next.js fix-30791 | Change | |
---|---|---|---|
index.html gzip | 522 B | 522 B | ✓ |
link.html gzip | 535 B | 535 B | ✓ |
withRouter.html gzip | 517 B | 517 B | ✓ |
Overall change | 1.57 kB | 1.57 kB | ✓ |
Diffs
Diff for _buildManifest.js
@@ -12,7 +12,7 @@ self.__BUILD_MANIFEST = {
],
"/head": ["static\u002Fchunks\u002Fpages\u002Fhead-7100d3b2a548f0e4.js"],
"/hooks": ["static\u002Fchunks\u002Fpages\u002Fhooks-ff60bc61acd2698b.js"],
- "/image": ["static\u002Fchunks\u002Fpages\u002Fimage-2a8b03d7b35abada.js"],
+ "/image": ["static\u002Fchunks\u002Fpages\u002Fimage-91f7c5ff8695376c.js"],
"/link": ["static\u002Fchunks\u002Fpages\u002Flink-fa969765a079642e.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-76232dd6bc335a24.js"
Diff for image-HASH.js
@@ -9,7 +9,7 @@
(window.__NEXT_P = window.__NEXT_P || []).push([
"/image",
function() {
- return __webpack_require__(3155);
+ return __webpack_require__(5924);
}
]);
if (false) {
@@ -969,7 +969,7 @@
/***/
},
- /***/ 3155: /***/ function(
+ /***/ 5924: /***/ function(
__unused_webpack_module,
__webpack_exports__,
__webpack_require__
Default Build with SWC (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary | javivelasco/next.js fix-30791 | Change | |
---|---|---|---|
buildDuration | 23.9s | 22.6s | -1.2s |
buildDurationCached | 4s | 4.1s | |
nodeModulesSize | 338 MB | 338 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | javivelasco/next.js fix-30791 | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 3.663 | 3.944 | |
/ avg req/sec | 682.49 | 633.85 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.921 | 2.102 | |
/error-in-render avg req/sec | 1301.64 | 1189.59 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | javivelasco/next.js fix-30791 | Change | |
---|---|---|---|
450.HASH.js gzip | 179 B | 179 B | ✓ |
framework-HASH.js gzip | 42.3 kB | 42.3 kB | ✓ |
main-HASH.js gzip | 28.6 kB | 28.6 kB | ✓ |
webpack-HASH.js gzip | 1.44 kB | 1.44 kB | ✓ |
Overall change | 72.5 kB | 72.5 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | javivelasco/next.js fix-30791 | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages Overall increase ⚠️
vercel/next.js canary | javivelasco/next.js fix-30791 | Change | |
---|---|---|---|
_app-HASH.js gzip | 1.35 kB | 1.35 kB | ✓ |
_error-HASH.js gzip | 180 B | 180 B | ✓ |
amp-HASH.js gzip | 305 B | 305 B | ✓ |
css-HASH.js gzip | 321 B | 321 B | ✓ |
dynamic-HASH.js gzip | 2.38 kB | 2.38 kB | ✓ |
head-HASH.js gzip | 342 B | 342 B | ✓ |
hooks-HASH.js gzip | 622 B | 622 B | ✓ |
image-HASH.js gzip | 4.46 kB | 4.47 kB | |
index-HASH.js gzip | 256 B | 256 B | ✓ |
link-HASH.js gzip | 1.91 kB | 1.91 kB | ✓ |
routerDirect..HASH.js gzip | 314 B | 314 B | ✓ |
script-HASH.js gzip | 375 B | 375 B | ✓ |
withRouter-HASH.js gzip | 309 B | 309 B | ✓ |
85e02e95b279..7e3.css gzip | 107 B | 107 B | ✓ |
Overall change | 13.2 kB | 13.2 kB |
Client Build Manifests Overall decrease ✓
vercel/next.js canary | javivelasco/next.js fix-30791 | Change | |
---|---|---|---|
_buildManifest.js gzip | 460 B | 459 B | -1 B |
Overall change | 460 B | 459 B | -1 B |
Rendered Page Sizes
vercel/next.js canary | javivelasco/next.js fix-30791 | Change | |
---|---|---|---|
index.html gzip | 523 B | 523 B | ✓ |
link.html gzip | 536 B | 536 B | ✓ |
withRouter.html gzip | 517 B | 517 B | ✓ |
Overall change | 1.58 kB | 1.58 kB | ✓ |
Diffs
Diff for _buildManifest.js
@@ -12,7 +12,7 @@ self.__BUILD_MANIFEST = {
],
"/head": ["static\u002Fchunks\u002Fpages\u002Fhead-7100d3b2a548f0e4.js"],
"/hooks": ["static\u002Fchunks\u002Fpages\u002Fhooks-ff60bc61acd2698b.js"],
- "/image": ["static\u002Fchunks\u002Fpages\u002Fimage-2a8b03d7b35abada.js"],
+ "/image": ["static\u002Fchunks\u002Fpages\u002Fimage-91f7c5ff8695376c.js"],
"/link": ["static\u002Fchunks\u002Fpages\u002Flink-fa969765a079642e.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-76232dd6bc335a24.js"
Diff for image-HASH.js
@@ -9,7 +9,7 @@
(window.__NEXT_P = window.__NEXT_P || []).push([
"/image",
function() {
- return __webpack_require__(3155);
+ return __webpack_require__(5924);
}
]);
if (false) {
@@ -969,7 +969,7 @@
/***/
},
- /***/ 3155: /***/ function(
+ /***/ 5924: /***/ function(
__unused_webpack_module,
__webpack_exports__,
__webpack_require__
Fixes #30791
The issue is that with Middleware we are introducing client compilation on a new layer. When a middleware changes (or is dropped after some time), Webpack reorganizes non-user modules as they are duplicated across different layer. This is currently triggering a full reload.
This also brings tests for HMR: