-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
Add dangerously-unoptimized
loader for next/image
#26847
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
darshkpatel
requested review from
huozhi,
ijjk,
padmaia,
shuding,
styfle and
timneutkens
as code owners
July 4, 2021 10:55
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
styfle
reviewed
Jul 5, 2021
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.
Thanks for the PR!
Let's get feedback in RFC #26850 before proceeding 👍
ijjk
reviewed
Jul 7, 2021
ijjk
reviewed
Jul 7, 2021
ijjk
reviewed
Jul 7, 2021
styfle
reviewed
Jul 7, 2021
styfle
reviewed
Jul 7, 2021
Co-authored-by: Steven <steven@ceriously.com>
styfle
previously approved these changes
Jul 7, 2021
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.
Thanks!
styfle
changed the title
Static loader support for next/image
Add Jul 7, 2021
dangerously-unoptimized
loader for next/image
ijjk
previously approved these changes
Jul 7, 2021
This comment has been minimized.
This comment has been minimized.
ijjk
approved these changes
Jul 7, 2021
Stats from current PRDefault Build (Increase detected
|
vercel/next.js canary | darshkpatel/next.js static-loader | Change | |
---|---|---|---|
buildDuration | 16.7s | 16.7s | -37ms |
buildDurationCached | 3.9s | 3.8s | -113ms |
nodeModulesSize | 49.3 MB | 49.3 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | darshkpatel/next.js static-loader | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.775 | 2.747 | -0.03 |
/ avg req/sec | 901.05 | 909.95 | +8.9 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.737 | 1.735 | 0 |
/error-in-render avg req/sec | 1439.09 | 1440.85 | +1.76 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | darshkpatel/next.js static-loader | Change | |
---|---|---|---|
359.HASH.js gzip | 3.09 kB | 3.09 kB | ✓ |
framework-HASH.js gzip | 42 kB | 42 kB | ✓ |
main-HASH.js gzip | 20.6 kB | 20.6 kB | ✓ |
webpack-HASH.js gzip | 1.49 kB | 1.49 kB | ✓ |
Overall change | 67.2 kB | 67.2 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | darshkpatel/next.js static-loader | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31.1 kB | 31.1 kB | ✓ |
Overall change | 31.1 kB | 31.1 kB | ✓ |
Client Pages Overall increase ⚠️
vercel/next.js canary | darshkpatel/next.js static-loader | Change | |
---|---|---|---|
_app-HASH.js gzip | 803 B | 803 B | ✓ |
_error-HASH.js gzip | 3.18 kB | 3.18 kB | ✓ |
amp-HASH.js gzip | 526 B | 526 B | ✓ |
css-HASH.js gzip | 329 B | 329 B | ✓ |
hooks-HASH.js gzip | 903 B | 903 B | ✓ |
image-HASH.js gzip | 5.6 kB | 5.62 kB | |
index-HASH.js gzip | 261 B | 261 B | ✓ |
link-HASH.js gzip | 1.66 kB | 1.66 kB | ✓ |
routerDirect..HASH.js gzip | 319 B | 319 B | ✓ |
withRouter-HASH.js gzip | 320 B | 320 B | ✓ |
bb14e60e810b..30f.css gzip | 125 B | 125 B | ✓ |
Overall change | 14 kB | 14 kB |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | darshkpatel/next.js static-loader | Change | |
---|---|---|---|
_buildManifest.js gzip | 418 B | 419 B | |
Overall change | 418 B | 419 B |
Rendered Page Sizes
vercel/next.js canary | darshkpatel/next.js static-loader | Change | |
---|---|---|---|
index.html gzip | 531 B | 531 B | ✓ |
link.html gzip | 544 B | 544 B | ✓ |
withRouter.html gzip | 524 B | 524 B | ✓ |
Overall change | 1.6 kB | 1.6 kB | ✓ |
Diffs
Diff for _buildManifest.js
@@ -13,7 +13,7 @@ self.__BUILD_MANIFEST = {
"static\u002Fchunks\u002Fpages\u002Fhooks-4e38b05900fed34fcf34.js"
],
"/image": [
- "static\u002Fchunks\u002Fpages\u002Fimage-0a8987f5a01c8fb53ae0.js"
+ "static\u002Fchunks\u002Fpages\u002Fimage-f70c91ef36603165d772.js"
],
"/link": ["static\u002Fchunks\u002Fpages\u002Flink-461e3656f357dad048d3.js"],
"/routerDirect": [
Diff for image-HASH.js
@@ -131,7 +131,8 @@
["imgix", imgixLoader],
["cloudinary", cloudinaryLoader],
["akamai", akamaiLoader],
- ["default", defaultLoader]
+ ["default", defaultLoader],
+ ["dangerously-unoptimized", unoptimizedLoader]
]);
var VALID_LAYOUT_VALUES = [
"fill",
@@ -752,11 +753,16 @@
.concat(normalizeSrc(src));
}
- function defaultLoader(_ref9) {
- var root = _ref9.root,
- src = _ref9.src,
- width = _ref9.width,
- quality = _ref9.quality;
+ function unoptimizedLoader(_ref9) {
+ var src = _ref9.src;
+ return src;
+ }
+
+ function defaultLoader(_ref10) {
+ var root = _ref10.root,
+ src = _ref10.src,
+ width = _ref10.width,
+ quality = _ref10.quality;
if (false) {
var parsedSrc, missingValues;
@@ -1532,7 +1538,13 @@ Also adds support for deduplicated `key` properties
"use strict";
exports.__esModule = true;
exports.imageConfigDefault = exports.VALID_LOADERS = void 0;
- const VALID_LOADERS = ["default", "imgix", "cloudinary", "akamai"];
+ const VALID_LOADERS = [
+ "default",
+ "imgix",
+ "cloudinary",
+ "akamai",
+ "dangerously-unoptimized"
+ ];
exports.VALID_LOADERS = VALID_LOADERS;
const imageConfigDefault = {
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
Webpack 4 Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary | darshkpatel/next.js static-loader | Change | |
---|---|---|---|
buildDuration | 13.1s | 13.3s | |
buildDurationCached | 5.3s | 5.3s | -37ms |
nodeModulesSize | 49.3 MB | 49.3 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | darshkpatel/next.js static-loader | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.804 | 2.788 | -0.02 |
/ avg req/sec | 891.59 | 896.75 | +5.16 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.667 | 1.703 | |
/error-in-render avg req/sec | 1499.31 | 1468.23 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | darshkpatel/next.js static-loader | Change | |
---|---|---|---|
14.HASH.js gzip | 3.11 kB | 3.11 kB | ✓ |
677f882d2ed8..HASH.js gzip | 13.9 kB | 13.9 kB | ✓ |
framework.HASH.js gzip | 41.8 kB | 41.8 kB | ✓ |
main-HASH.js gzip | 7.81 kB | 7.81 kB | ✓ |
webpack-HASH.js gzip | 1.19 kB | 1.19 kB | ✓ |
Overall change | 67.8 kB | 67.8 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | darshkpatel/next.js static-loader | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31.3 kB | 31.3 kB | ✓ |
Overall change | 31.3 kB | 31.3 kB | ✓ |
Client Pages
vercel/next.js canary | darshkpatel/next.js static-loader | Change | |
---|---|---|---|
_app-HASH.js gzip | 791 B | 791 B | ✓ |
_error-HASH.js gzip | 3.83 kB | 3.83 kB | ✓ |
amp-HASH.js gzip | 531 B | 531 B | ✓ |
css-HASH.js gzip | 333 B | 333 B | ✓ |
hooks-HASH.js gzip | 910 B | 910 B | ✓ |
index-HASH.js gzip | 230 B | 230 B | ✓ |
link-HASH.js gzip | 1.64 kB | 1.64 kB | ✓ |
routerDirect..HASH.js gzip | 297 B | 297 B | ✓ |
withRouter-HASH.js gzip | 293 B | 293 B | ✓ |
e025d2764813..52f.css gzip | 125 B | 125 B | ✓ |
Overall change | 8.98 kB | 8.98 kB | ✓ |
Client Build Manifests
vercel/next.js canary | darshkpatel/next.js static-loader | Change | |
---|---|---|---|
_buildManifest.js gzip | 418 B | 418 B | ✓ |
Overall change | 418 B | 418 B | ✓ |
Rendered Page Sizes
vercel/next.js canary | darshkpatel/next.js static-loader | Change | |
---|---|---|---|
index.html gzip | 575 B | 575 B | ✓ |
link.html gzip | 586 B | 586 B | ✓ |
withRouter.html gzip | 568 B | 568 B | ✓ |
Overall change | 1.73 kB | 1.73 kB | ✓ |
kodiakhq bot
pushed a commit
that referenced
this pull request
Jul 8, 2021
… applicable (#26998) Since we are no longer accepting new built-in loaders, users may wish to use a different cloud provider. So this PR renames `dangerously-unoptimized` to `custom` to handle this case as well as the intention of `next export`. If the user doesn't add a `loader` prop, we throw an error. If the user adds a `loader` prop but it doesn't return the width, we print a warning. - Follow up to #26847 - Fixes #21079 - Fixes #19612 - Related to #26850
flybayer
pushed a commit
to blitz-js/next.js
that referenced
this pull request
Aug 19, 2021
* add support for static loader * update existing test * add test * add prettier-ignore * update docs * apply suggestions from review * remove un-needed normalize * Apply suggestions from code review Co-authored-by: Steven <steven@ceriously.com> * update test Co-authored-by: JJ Kasper <jj@jjsweb.site> Co-authored-by: Steven <steven@ceriously.com>
flybayer
pushed a commit
to blitz-js/next.js
that referenced
this pull request
Aug 19, 2021
… applicable (vercel#26998) Since we are no longer accepting new built-in loaders, users may wish to use a different cloud provider. So this PR renames `dangerously-unoptimized` to `custom` to handle this case as well as the intention of `next export`. If the user doesn't add a `loader` prop, we throw an error. If the user adds a `loader` prop but it doesn't return the width, we print a warning. - Follow up to vercel#26847 - Fixes vercel#21079 - Fixes vercel#19612 - Related to vercel#26850
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to: #21079
RFC Link: #26850
Added loader
dangerously-unoptimized
which basically returns the src URL, this would also allownext export
to run without errors and Images without a custom loader specified can fallback to thestatic
loader.ToDo: