You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable or disable setting `Cache-Control: public, max-age=31536000, immutable` response header for immutable assets (i.e. asset with a hash like `image.a4c12bde.jpg`).
214
+
214
215
Immutable assets are assets that have their hash in the file name therefore they can be cached, because if you change their contents the file name will be changed.
215
-
When omitted, immutable assets use this header by default.
216
-
Set `cacheImmutable: false` to fall back to the `cacheControl` option even for immutable assets.
217
-
This takes precedence over the `cacheControl` option only when the asset was defined as immutable and `cacheImmutable` is not `false`.
216
+
217
+
When omitted, immutable assets fall back to the `cacheControl` option.
218
+
219
+
Set `cacheImmutable: true` to opt into the immutable cache header for hashed assets.
220
+
This takes precedence over the `cacheControl` option only when the asset was defined as immutable and `cacheImmutable` is `true`.
Copy file name to clipboardExpand all lines: test/middleware.test.js
+6-4Lines changed: 6 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -6262,6 +6262,7 @@ describe.each([
6262
6262
name,
6263
6263
framework,
6264
6264
compiler,
6265
+
{cacheImmutable: true},
6265
6266
);
6266
6267
});
6267
6268
@@ -6306,6 +6307,7 @@ describe.each([
6306
6307
name,
6307
6308
framework,
6308
6309
compiler,
6310
+
{cacheImmutable: true},
6309
6311
);
6310
6312
});
6311
6313
@@ -6350,7 +6352,7 @@ describe.each([
6350
6352
name,
6351
6353
framework,
6352
6354
compiler,
6353
-
{cacheControl: 1000000},
6355
+
{cacheImmutable: true,cacheControl: 1000000},
6354
6356
);
6355
6357
});
6356
6358
@@ -6603,7 +6605,7 @@ describe.each([
6603
6605
});
6604
6606
});
6605
6607
6606
-
describe("should use cacheControl object option with explicit immutable false",()=>{
6608
+
describe("should use cacheControl object option with explicit immutable false when cacheImmutable is not enabled",()=>{
6607
6609
beforeEach(async()=>{
6608
6610
constcompiler=getCompiler({
6609
6611
...webpackConfigImmutable,
@@ -6634,7 +6636,7 @@ describe.each([
6634
6636
);
6635
6637
});
6636
6638
6637
-
it('should return the "200" code for the "GET" request to the immutable asset and generate `Cache-Control` header for the immutable asset by default',async()=>{
6639
+
it('should return the "200" code for the "GET" request to the immutable asset and generate `Cache-Control` header from cacheControl without immutable',async()=>{
0 commit comments