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

Fix AMP HMR for child components #9736

Merged
merged 2 commits into from
Dec 16, 2019
Merged

Conversation

ijjk
Copy link
Member

@ijjk ijjk commented Dec 13, 2019

Since we were dropping client bundles for AMP first pages before webpack tracked the child dependencies HMR wouldn't be triggered when a dependency was changed as @timneutkens noticed

This fixes it by not dropping the client bundle in development and instead 404's by requiring the server bundle and checking if the page is AMP first

@ijjk ijjk added the Type: Bug label Dec 13, 2019
@ijjk ijjk added this to the 9.1.6 milestone Dec 13, 2019
@ijjk
Copy link
Member Author

ijjk commented Dec 13, 2019

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
buildDuration 13.3s 13.3s -3ms
nodeModulesSize 46.9 MB 46.9 MB ⚠️ +205 B
Client Bundles (main, webpack, commons)
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
main-HASH.js 18.5 kB 18.5 kB
main-HASH.js gzip 6.49 kB 6.49 kB
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..1db6754d3.js 12 kB 12 kB
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js 10.9 kB 10.9 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..4155a1d0b.js 38.3 kB 38.3 kB
de003c3a9d30..1d0b.js gzip 13.9 kB 13.9 kB
framework.HASH.js 126 kB 126 kB
framework.HASH.js gzip 39.5 kB 39.5 kB
Overall change 207 kB 207 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
main-HASH.module.js 14.5 kB 14.5 kB
main-HASH.module.js gzip 5.42 kB 5.42 kB
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..b9.module.js 14.9 kB 14.9 kB
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..8b.module.js 33.1 kB 33.1 kB
de003c3a9d30..dule.js gzip 12.5 kB 12.5 kB
framework.HASH.module.js 126 kB 126 kB
framework.HA..dule.js gzip 39.4 kB 39.4 kB
Overall change 190 kB 190 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
polyfills-HASH.js 15.3 kB 15.3 kB
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 15.3 kB 15.3 kB
Client Pages
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
_app.js 2.94 kB 2.94 kB
_app.js gzip 1.33 kB 1.33 kB
_error.js 10.4 kB 10.4 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js 1.44 kB 1.44 kB
hooks.js gzip 779 B 779 B
index.js 318 B 318 B
index.js gzip 222 B 222 B
link.js 6.77 kB 6.77 kB
link.js gzip 2.89 kB 2.89 kB
routerDirect.js 411 B 411 B
routerDirect.js gzip 283 B 283 B
withRouter.js 421 B 421 B
withRouter.js gzip 282 B 282 B
Overall change 22.7 kB 22.7 kB
Client Pages Modern
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
_app.module.js 1.54 kB 1.54 kB
_app.module.js gzip 757 B 757 B
_error.module.js 7.35 kB 7.35 kB
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js 651 B 651 B
hooks.module.js gzip 371 B 371 B
index.module.js 276 B 276 B
index.module.js gzip 212 B 212 B
link.module.js 5.45 kB 5.45 kB
link.module.js gzip 2.46 kB 2.46 kB
routerDirect.module.js 383 B 383 B
routerDirect..dule.js gzip 273 B 273 B
withRouter.module.js 394 B 394 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 16 kB 16 kB
Client Build Manifests
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
_buildManifest.js 81 B 81 B
_buildManifest.js gzip 61 B 61 B
_buildManifest.module.js 81 B 81 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 162 B 162 B
Rendered Page Sizes
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
index.html 4.06 kB 4.06 kB
index.html gzip 1.04 kB 1.04 kB
link.html 4.11 kB 4.11 kB
link.html gzip 1.04 kB 1.04 kB
withRouter.html 4.12 kB 4.12 kB
withRouter.html gzip 1.03 kB 1.03 kB
Overall change 12.3 kB 12.3 kB

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
buildDuration 13.4s 13.7s ⚠️ +262ms
nodeModulesSize 46.9 MB 46.9 MB ⚠️ +205 B
Client Bundles (main, webpack, commons)
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
main-HASH.js 18.5 kB 18.5 kB
main-HASH.js gzip 6.49 kB 6.49 kB
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..1db6754d3.js 12 kB 12 kB
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js 10.9 kB 10.9 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..4155a1d0b.js 38.3 kB 38.3 kB
de003c3a9d30..1d0b.js gzip 13.9 kB 13.9 kB
framework.HASH.js 126 kB 126 kB
framework.HASH.js gzip 39.5 kB 39.5 kB
Overall change 207 kB 207 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
main-HASH.module.js 14.5 kB 14.5 kB
main-HASH.module.js gzip 5.42 kB 5.42 kB
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..b9.module.js 14.9 kB 14.9 kB
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..8b.module.js 33.1 kB 33.1 kB
de003c3a9d30..dule.js gzip 12.5 kB 12.5 kB
framework.HASH.module.js 126 kB 126 kB
framework.HA..dule.js gzip 39.4 kB 39.4 kB
Overall change 190 kB 190 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
polyfills-HASH.js 15.3 kB 15.3 kB
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 15.3 kB 15.3 kB
Client Pages
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
_app.js 2.94 kB 2.94 kB
_app.js gzip 1.33 kB 1.33 kB
_error.js 10.4 kB 10.4 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js 1.44 kB 1.44 kB
hooks.js gzip 779 B 779 B
index.js 318 B 318 B
index.js gzip 222 B 222 B
link.js 6.77 kB 6.77 kB
link.js gzip 2.89 kB 2.89 kB
routerDirect.js 411 B 411 B
routerDirect.js gzip 283 B 283 B
withRouter.js 421 B 421 B
withRouter.js gzip 282 B 282 B
Overall change 22.7 kB 22.7 kB
Client Pages Modern
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
_app.module.js 1.54 kB 1.54 kB
_app.module.js gzip 757 B 757 B
_error.module.js 7.35 kB 7.35 kB
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js 651 B 651 B
hooks.module.js gzip 371 B 371 B
index.module.js 276 B 276 B
index.module.js gzip 212 B 212 B
link.module.js 5.45 kB 5.45 kB
link.module.js gzip 2.46 kB 2.46 kB
routerDirect.module.js 383 B 383 B
routerDirect..dule.js gzip 273 B 273 B
withRouter.module.js 394 B 394 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 16 kB 16 kB
Client Build Manifests
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
_buildManifest.js 81 B 81 B
_buildManifest.js gzip 61 B 61 B
_buildManifest.module.js 81 B 81 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 162 B 162 B
Serverless bundles
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
_error.js 281 kB 281 kB
_error.js gzip 74.8 kB 74.8 kB
hooks.html 4.19 kB 4.19 kB
hooks.html gzip 1.07 kB 1.07 kB
index.js 281 kB 281 kB
index.js gzip 75.1 kB 75.1 kB
link.js 289 kB 289 kB
link.js gzip 77.1 kB 77.1 kB
routerDirect.js 282 kB 282 kB
routerDirect.js gzip 75.1 kB 75.1 kB
withRouter.js 282 kB 282 kB
withRouter.js gzip 75.2 kB 75.2 kB
Overall change 1.42 MB 1.42 MB

Commit: 43a34e5

@ijjk
Copy link
Member Author

ijjk commented Dec 16, 2019

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
buildDuration 12.6s 12.6s ⚠️ +40ms
nodeModulesSize 46.9 MB 46.9 MB ⚠️ +205 B
Client Bundles (main, webpack, commons)
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
main-HASH.js 18.5 kB 18.5 kB
main-HASH.js gzip 6.5 kB 6.5 kB
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..1db6754d3.js 12 kB 12 kB
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js 10.9 kB 10.9 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..7d55a2235.js 38.3 kB 38.3 kB
de003c3a9d30..2235.js gzip 13.9 kB 13.9 kB
framework.HASH.js 126 kB 126 kB
framework.HASH.js gzip 39.5 kB 39.5 kB
Overall change 207 kB 207 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
main-HASH.module.js 14.5 kB 14.5 kB
main-HASH.module.js gzip 5.42 kB 5.42 kB
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..b9.module.js 14.9 kB 14.9 kB
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..a0.module.js 33.1 kB 33.1 kB
de003c3a9d30..dule.js gzip 12.5 kB 12.5 kB
framework.HASH.module.js 126 kB 126 kB
framework.HA..dule.js gzip 39.4 kB 39.4 kB
Overall change 190 kB 190 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
polyfills-HASH.js 15.3 kB 15.3 kB
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 15.3 kB 15.3 kB
Client Pages
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
_app.js 2.94 kB 2.94 kB
_app.js gzip 1.33 kB 1.33 kB
_error.js 10.4 kB 10.4 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js 1.44 kB 1.44 kB
hooks.js gzip 779 B 779 B
index.js 318 B 318 B
index.js gzip 222 B 222 B
link.js 6.77 kB 6.77 kB
link.js gzip 2.89 kB 2.89 kB
routerDirect.js 411 B 411 B
routerDirect.js gzip 283 B 283 B
withRouter.js 421 B 421 B
withRouter.js gzip 282 B 282 B
Overall change 22.7 kB 22.7 kB
Client Pages Modern
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
_app.module.js 1.54 kB 1.54 kB
_app.module.js gzip 757 B 757 B
_error.module.js 7.35 kB 7.35 kB
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js 651 B 651 B
hooks.module.js gzip 371 B 371 B
index.module.js 276 B 276 B
index.module.js gzip 212 B 212 B
link.module.js 5.45 kB 5.45 kB
link.module.js gzip 2.46 kB 2.46 kB
routerDirect.module.js 383 B 383 B
routerDirect..dule.js gzip 273 B 273 B
withRouter.module.js 394 B 394 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 16 kB 16 kB
Client Build Manifests
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
_buildManifest.js 81 B 81 B
_buildManifest.js gzip 61 B 61 B
_buildManifest.module.js 81 B 81 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 162 B 162 B
Rendered Page Sizes
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
index.html 4.06 kB 4.06 kB
index.html gzip 1.04 kB 1.04 kB
link.html 4.11 kB 4.11 kB
link.html gzip 1.05 kB 1.05 kB
withRouter.html 4.12 kB 4.12 kB
withRouter.html gzip 1.03 kB 1.03 kB
Overall change 12.3 kB 12.3 kB

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
buildDuration 13s 12.9s -92ms
nodeModulesSize 46.9 MB 46.9 MB ⚠️ +205 B
Client Bundles (main, webpack, commons)
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
main-HASH.js 18.5 kB 18.5 kB
main-HASH.js gzip 6.5 kB 6.5 kB
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..1db6754d3.js 12 kB 12 kB
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js 10.9 kB 10.9 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..7d55a2235.js 38.3 kB 38.3 kB
de003c3a9d30..2235.js gzip 13.9 kB 13.9 kB
framework.HASH.js 126 kB 126 kB
framework.HASH.js gzip 39.5 kB 39.5 kB
Overall change 207 kB 207 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
main-HASH.module.js 14.5 kB 14.5 kB
main-HASH.module.js gzip 5.42 kB 5.42 kB
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..b9.module.js 14.9 kB 14.9 kB
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..a0.module.js 33.1 kB 33.1 kB
de003c3a9d30..dule.js gzip 12.5 kB 12.5 kB
framework.HASH.module.js 126 kB 126 kB
framework.HA..dule.js gzip 39.4 kB 39.4 kB
Overall change 190 kB 190 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
polyfills-HASH.js 15.3 kB 15.3 kB
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 15.3 kB 15.3 kB
Client Pages
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
_app.js 2.94 kB 2.94 kB
_app.js gzip 1.33 kB 1.33 kB
_error.js 10.4 kB 10.4 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js 1.44 kB 1.44 kB
hooks.js gzip 779 B 779 B
index.js 318 B 318 B
index.js gzip 222 B 222 B
link.js 6.77 kB 6.77 kB
link.js gzip 2.89 kB 2.89 kB
routerDirect.js 411 B 411 B
routerDirect.js gzip 283 B 283 B
withRouter.js 421 B 421 B
withRouter.js gzip 282 B 282 B
Overall change 22.7 kB 22.7 kB
Client Pages Modern
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
_app.module.js 1.54 kB 1.54 kB
_app.module.js gzip 757 B 757 B
_error.module.js 7.35 kB 7.35 kB
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js 651 B 651 B
hooks.module.js gzip 371 B 371 B
index.module.js 276 B 276 B
index.module.js gzip 212 B 212 B
link.module.js 5.45 kB 5.45 kB
link.module.js gzip 2.46 kB 2.46 kB
routerDirect.module.js 383 B 383 B
routerDirect..dule.js gzip 273 B 273 B
withRouter.module.js 394 B 394 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 16 kB 16 kB
Client Build Manifests
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
_buildManifest.js 81 B 81 B
_buildManifest.js gzip 61 B 61 B
_buildManifest.module.js 81 B 81 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 162 B 162 B
Serverless bundles
zeit/next.js canary ijjk/next.js test/amp-first-hmr Change
_error.js 281 kB 281 kB
_error.js gzip 74.9 kB 74.9 kB
hooks.html 4.19 kB 4.19 kB
hooks.html gzip 1.07 kB 1.07 kB
index.js 281 kB 281 kB
index.js gzip 75.1 kB 75.1 kB
link.js 289 kB 289 kB
link.js gzip 77.2 kB 77.2 kB
routerDirect.js 282 kB 282 kB
routerDirect.js gzip 75.2 kB 75.2 kB
withRouter.js 282 kB 282 kB
withRouter.js gzip 75.3 kB 75.3 kB
Overall change 1.42 MB 1.42 MB

Commit: b1b14ad

@ijjk ijjk merged commit fd95d6c into vercel:canary Dec 16, 2019
@ijjk ijjk deleted the test/amp-first-hmr branch December 16, 2019 17:45
@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.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants