-
Notifications
You must be signed in to change notification settings - Fork 28k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add experimental wildcard remotePatterns
config for upstream images
#36245
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
images.remotePatterns
configimages.remotePatterns
config for upstream images
Stats from current PRDefault Build (Decrease detected ✓)General Overall increase
|
vercel/next.js canary | vercel/next.js 27925-add-remote-patterns | Change | |
---|---|---|---|
buildDuration | 19.7s | 20s | |
buildDurationCached | 7.8s | 7.6s | -257ms |
nodeModulesSize | 475 MB | 475 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | vercel/next.js 27925-add-remote-patterns | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 5.115 | 5.206 | |
/ avg req/sec | 488.74 | 480.17 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 2.189 | 2.222 | |
/error-in-render avg req/sec | 1141.99 | 1124.9 |
Client Bundles (main, webpack)
vercel/next.js canary | vercel/next.js 27925-add-remote-patterns | Change | |
---|---|---|---|
925.HASH.js gzip | 179 B | 179 B | ✓ |
framework-HASH.js gzip | 42 kB | 42 kB | ✓ |
main-HASH.js gzip | 28.8 kB | 28.8 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 | vercel/next.js 27925-add-remote-patterns | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | vercel/next.js 27925-add-remote-patterns | Change | |
---|---|---|---|
_app-HASH.js gzip | 1.36 kB | 1.36 kB | ✓ |
_error-HASH.js gzip | 193 B | 193 B | ✓ |
amp-HASH.js gzip | 308 B | 308 B | ✓ |
css-HASH.js gzip | 327 B | 327 B | ✓ |
dynamic-HASH.js gzip | 3.08 kB | 3.08 kB | ✓ |
head-HASH.js gzip | 359 B | 359 B | ✓ |
hooks-HASH.js gzip | 920 B | 920 B | ✓ |
image-HASH.js gzip | 5.71 kB | 5.7 kB | -9 B |
index-HASH.js gzip | 263 B | 263 B | ✓ |
link-HASH.js gzip | 2.64 kB | 2.64 kB | ✓ |
routerDirect..HASH.js gzip | 320 B | 320 B | ✓ |
script-HASH.js gzip | 391 B | 391 B | ✓ |
withRouter-HASH.js gzip | 318 B | 318 B | ✓ |
85e02e95b279..7e3.css gzip | 107 B | 107 B | ✓ |
Overall change | 16.3 kB | 16.3 kB | -9 B |
Client Build Manifests
vercel/next.js canary | vercel/next.js 27925-add-remote-patterns | Change | |
---|---|---|---|
_buildManifest.js gzip | 459 B | 459 B | ✓ |
Overall change | 459 B | 459 B | ✓ |
Rendered Page Sizes
vercel/next.js canary | vercel/next.js 27925-add-remote-patterns | Change | |
---|---|---|---|
index.html gzip | 530 B | 530 B | ✓ |
link.html gzip | 544 B | 544 B | ✓ |
withRouter.html gzip | 526 B | 526 B | ✓ |
Overall change | 1.6 kB | 1.6 kB | ✓ |
Diffs
Diff for _buildManifest.js
@@ -12,7 +12,7 @@ self.__BUILD_MANIFEST = {
],
"/head": ["static\u002Fchunks\u002Fpages\u002Fhead-544bb68363445a0e.js"],
"/hooks": ["static\u002Fchunks\u002Fpages\u002Fhooks-c1372eeb4916d32c.js"],
- "/image": ["static\u002Fchunks\u002Fpages\u002Fimage-75136b1767faacf3.js"],
+ "/image": ["static\u002Fchunks\u002Fpages\u002Fimage-550ed853173c68fb.js"],
"/link": ["static\u002Fchunks\u002Fpages\u002Flink-ca5e63d57db66cd2.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-113a7082ae16fbcb.js"
Diff for image-HASH.js
@@ -619,17 +619,22 @@
}
return target;
}
- var ref;
- var experimentalLayoutRaw =
- (ref = {
- deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
- imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
- path: "/_next/image",
- loader: "default",
- experimentalLayoutRaw: false
- }) === null || ref === void 0
- ? void 0
- : ref.experimentalLayoutRaw;
+ var ref =
+ {
+ deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
+ imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
+ path: "/_next/image",
+ loader: "default",
+ experimentalLayoutRaw: false
+ } || {},
+ _experimentalLayoutRaw = ref.experimentalLayoutRaw,
+ experimentalLayoutRaw =
+ _experimentalLayoutRaw === void 0 ? false : _experimentalLayoutRaw,
+ _experimentalRemotePatterns = ref.experimentalRemotePatterns,
+ experimentalRemotePatterns =
+ _experimentalRemotePatterns === void 0
+ ? []
+ : _experimentalRemotePatterns;
var configEnv = {
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
@@ -756,9 +761,9 @@
sizes: undefined
};
}
- var ref3 = getWidths(config, width, layout, sizes),
- widths = ref3.widths,
- kind = ref3.kind;
+ var ref4 = getWidths(config, width, layout, sizes),
+ widths = ref4.widths,
+ kind = ref4.kind;
var last = widths.length - 1;
return {
sizes: !sizes && kind === "w" ? "100vw" : sizes,
@@ -802,11 +807,11 @@
return undefined;
}
function defaultImageLoader(loaderProps) {
- var ref2;
+ var ref5;
var loaderKey =
- ((ref2 = loaderProps.config) === null || ref2 === void 0
+ ((ref5 = loaderProps.config) === null || ref5 === void 0
? void 0
- : ref2.loader) || "default";
+ : ref5.loader) || "default";
var load = loaders.get(loaderKey);
if (load) {
return load(loaderProps);
@@ -864,7 +869,7 @@
});
}
if (false) {
- var parent, widthModified, heightModified, ref3;
+ var parent, widthModified, heightModified, ref6;
}
});
}
@@ -1081,7 +1086,7 @@
width = param.width,
quality = param.quality;
if (false) {
- var parsedSrc, missingValues;
+ var hasMatch, parsedSrc, missingValues;
}
if (src.endsWith(".svg") && !config.dangerouslyAllowSVG) {
// Special case to make svg serve as-is to avoid proxying
Default Build with SWC (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | vercel/next.js 27925-add-remote-patterns | Change | |
---|---|---|---|
buildDuration | 22.5s | 22.6s | |
buildDurationCached | 7.6s | 7.7s | |
nodeModulesSize | 475 MB | 475 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | vercel/next.js 27925-add-remote-patterns | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 5.029 | 5.077 | |
/ avg req/sec | 497.07 | 492.4 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 2.186 | 2.16 | -0.03 |
/error-in-render avg req/sec | 1143.67 | 1157.51 | +13.84 |
Client Bundles (main, webpack)
vercel/next.js canary | vercel/next.js 27925-add-remote-patterns | Change | |
---|---|---|---|
925.HASH.js gzip | 178 B | 178 B | ✓ |
framework-HASH.js gzip | 42.2 kB | 42.2 kB | ✓ |
main-HASH.js gzip | 29.2 kB | 29.2 kB | ✓ |
webpack-HASH.js gzip | 1.45 kB | 1.45 kB | ✓ |
Overall change | 73.1 kB | 73.1 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | vercel/next.js 27925-add-remote-patterns | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages Overall increase ⚠️
vercel/next.js canary | vercel/next.js 27925-add-remote-patterns | Change | |
---|---|---|---|
_app-HASH.js gzip | 1.35 kB | 1.35 kB | ✓ |
_error-HASH.js gzip | 179 B | 179 B | ✓ |
amp-HASH.js gzip | 312 B | 312 B | ✓ |
css-HASH.js gzip | 324 B | 324 B | ✓ |
dynamic-HASH.js gzip | 3.08 kB | 3.08 kB | ✓ |
head-HASH.js gzip | 357 B | 357 B | ✓ |
hooks-HASH.js gzip | 921 B | 921 B | ✓ |
image-HASH.js gzip | 5.76 kB | 5.79 kB | |
index-HASH.js gzip | 261 B | 261 B | ✓ |
link-HASH.js gzip | 2.76 kB | 2.76 kB | ✓ |
routerDirect..HASH.js gzip | 322 B | 322 B | ✓ |
script-HASH.js gzip | 392 B | 392 B | ✓ |
withRouter-HASH.js gzip | 317 B | 317 B | ✓ |
85e02e95b279..7e3.css gzip | 107 B | 107 B | ✓ |
Overall change | 16.5 kB | 16.5 kB |
Client Build Manifests Overall decrease ✓
vercel/next.js canary | vercel/next.js 27925-add-remote-patterns | Change | |
---|---|---|---|
_buildManifest.js gzip | 458 B | 456 B | -2 B |
Overall change | 458 B | 456 B | -2 B |
Rendered Page Sizes
vercel/next.js canary | vercel/next.js 27925-add-remote-patterns | Change | |
---|---|---|---|
index.html gzip | 530 B | 530 B | ✓ |
link.html gzip | 543 B | 543 B | ✓ |
withRouter.html gzip | 526 B | 526 B | ✓ |
Overall change | 1.6 kB | 1.6 kB | ✓ |
Diffs
Diff for _buildManifest.js
@@ -12,7 +12,7 @@ self.__BUILD_MANIFEST = {
],
"/head": ["static\u002Fchunks\u002Fpages\u002Fhead-544bb68363445a0e.js"],
"/hooks": ["static\u002Fchunks\u002Fpages\u002Fhooks-c1372eeb4916d32c.js"],
- "/image": ["static\u002Fchunks\u002Fpages\u002Fimage-75136b1767faacf3.js"],
+ "/image": ["static\u002Fchunks\u002Fpages\u002Fimage-550ed853173c68fb.js"],
"/link": ["static\u002Fchunks\u002Fpages\u002Flink-ca5e63d57db66cd2.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-113a7082ae16fbcb.js"
Diff for image-HASH.js
@@ -619,17 +619,22 @@
}
return target;
}
- var ref;
- var experimentalLayoutRaw =
- (ref = {
- deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
- imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
- path: "/_next/image",
- loader: "default",
- experimentalLayoutRaw: false
- }) === null || ref === void 0
- ? void 0
- : ref.experimentalLayoutRaw;
+ var ref =
+ {
+ deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
+ imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
+ path: "/_next/image",
+ loader: "default",
+ experimentalLayoutRaw: false
+ } || {},
+ _experimentalLayoutRaw = ref.experimentalLayoutRaw,
+ experimentalLayoutRaw =
+ _experimentalLayoutRaw === void 0 ? false : _experimentalLayoutRaw,
+ _experimentalRemotePatterns = ref.experimentalRemotePatterns,
+ experimentalRemotePatterns =
+ _experimentalRemotePatterns === void 0
+ ? []
+ : _experimentalRemotePatterns;
var configEnv = {
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
@@ -756,9 +761,9 @@
sizes: undefined
};
}
- var ref3 = getWidths(config, width, layout, sizes),
- widths = ref3.widths,
- kind = ref3.kind;
+ var ref4 = getWidths(config, width, layout, sizes),
+ widths = ref4.widths,
+ kind = ref4.kind;
var last = widths.length - 1;
return {
sizes: !sizes && kind === "w" ? "100vw" : sizes,
@@ -802,11 +807,11 @@
return undefined;
}
function defaultImageLoader(loaderProps) {
- var ref2;
+ var ref5;
var loaderKey =
- ((ref2 = loaderProps.config) === null || ref2 === void 0
+ ((ref5 = loaderProps.config) === null || ref5 === void 0
? void 0
- : ref2.loader) || "default";
+ : ref5.loader) || "default";
var load = loaders.get(loaderKey);
if (load) {
return load(loaderProps);
@@ -864,7 +869,7 @@
});
}
if (false) {
- var parent, widthModified, heightModified, ref3;
+ var parent, widthModified, heightModified, ref6;
}
});
}
@@ -1081,7 +1086,7 @@
width = param.width,
quality = param.quality;
if (false) {
- var parsedSrc, missingValues;
+ var hasMatch, parsedSrc, missingValues;
}
if (src.endsWith(".svg") && !config.dangerouslyAllowSVG) {
// Special case to make svg serve as-is to avoid proxying
This comment was marked as outdated.
This comment was marked as outdated.
images.remotePatterns
config for upstream imagesimages.remotePatterns
config
ijjk
reviewed
May 4, 2022
ijjk
reviewed
May 4, 2022
ijjk
reviewed
May 4, 2022
ijjk
reviewed
May 4, 2022
ijjk
reviewed
May 4, 2022
ijjk
reviewed
May 4, 2022
ijjk
reviewed
May 4, 2022
ijjk
reviewed
May 4, 2022
ijjk
reviewed
May 4, 2022
Co-authored-by: JJ Kasper <jj@jjsweb.site>
ijjk
reviewed
May 5, 2022
ijjk
previously approved these changes
May 5, 2022
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 good, thanks! 🙌
Co-authored-by: JJ Kasper <jj@jjsweb.site>
ijjk
approved these changes
May 5, 2022
# for free
to subscribe to this conversation on GitHub.
Already have an account?
#.
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.
Description
This PR implements a new configuration object in
next.config.js
calledexperimental.images.remotePatterns
.This will eventually deprecate
images.domains
because it covers the same use cases and more by allowing wildcard pattern matching onhostname
andpathname
and also allows restrictingprotocol
andport
.Feature
contributing.md
Related