File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
packages/runtime/src/helpers Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -206,7 +206,12 @@ export const writeEdgeFunctions = async (netlifyConfig: NetlifyConfig) => {
206
206
await copy ( getEdgeTemplatePath ( '../edge-shared' ) , join ( edgeFunctionRoot , 'edge-shared' ) )
207
207
await writeJSON ( join ( edgeFunctionRoot , 'edge-shared' , 'nextConfig.json' ) , nextConfig )
208
208
209
- if ( ! process . env . NEXT_DISABLE_EDGE_IMAGES ) {
209
+ if (
210
+ process . env . NEXT_DISABLE_EDGE_IMAGES !== '1' &&
211
+ process . env . NEXT_DISABLE_EDGE_IMAGES !== 'true' &&
212
+ process . env . NEXT_DISABLE_NETLIFY_EDGE !== 'true' &&
213
+ process . env . NEXT_DISABLE_NETLIFY_EDGE !== '1'
214
+ ) {
210
215
console . log (
211
216
'Using Netlify Edge Functions for image format detection. Set env var "NEXT_DISABLE_EDGE_IMAGES=true" to disable.' ,
212
217
)
Original file line number Diff line number Diff line change @@ -571,6 +571,29 @@ describe('onBuild()', () => {
571
571
'X-Foo' : mockHeaderValue ,
572
572
} )
573
573
} )
574
+
575
+ test ( 'generates an ipx edge function by default' , async ( ) => {
576
+ await moveNextDist ( )
577
+ await nextRuntime . onBuild ( defaultArgs )
578
+ expect ( existsSync ( path . join ( '.netlify' , 'edge-functions' , 'ipx' , 'index.ts' ) ) ) . toBeTruthy ( )
579
+ } )
580
+
581
+ test ( 'does not generate an ipx edge function if the feature is disabled' , async ( ) => {
582
+ process . env . NEXT_DISABLE_EDGE_IMAGES = '1'
583
+ await moveNextDist ( )
584
+ await nextRuntime . onBuild ( defaultArgs )
585
+ expect ( existsSync ( path . join ( '.netlify' , 'edge-functions' , 'ipx' , 'index.ts' ) ) ) . toBeFalsy ( )
586
+ delete process . env . NEXT_DISABLE_EDGE_IMAGES
587
+ } )
588
+
589
+ test ( 'does not generate an ipx edge function if Netlify Edge is disabled' , async ( ) => {
590
+ process . env . NEXT_DISABLE_NETLIFY_EDGE = '1'
591
+ await moveNextDist ( )
592
+ await nextRuntime . onBuild ( defaultArgs )
593
+
594
+ expect ( existsSync ( path . join ( '.netlify' , 'edge-functions' , 'ipx' , 'index.ts' ) ) ) . toBeFalsy ( )
595
+ delete process . env . NEXT_DISABLE_NETLIFY_EDGE
596
+ } )
574
597
} )
575
598
576
599
describe ( 'onPostBuild' , ( ) => {
You can’t perform that action at this time.
0 commit comments