@@ -19,7 +19,7 @@ import { updateConfig, writeEdgeFunctions, loadMiddlewareManifest } from './help
19
19
import { moveStaticPages , movePublicFiles , patchNextFiles , unpatchNextFiles } from './helpers/files'
20
20
import { generateFunctions , setupImageFunction , generatePagesResolver } from './helpers/functions'
21
21
import { generateRedirects , generateStaticRedirects } from './helpers/redirects'
22
- import { shouldSkip , isNextAuthInstalled , getCustomImageResponseHeaders } from './helpers/utils'
22
+ import { shouldSkip , isNextAuthInstalled , isOldPluginInstalled , getCustomImageResponseHeaders } from './helpers/utils'
23
23
import {
24
24
verifyNetlifyBuildVersion ,
25
25
checkNextSiteHasBuilt ,
@@ -39,6 +39,10 @@ const plugin: NetlifyPlugin = {
39
39
cache,
40
40
} ,
41
41
} ) {
42
+ if ( isOldPluginInstalled ( ) ) {
43
+ return
44
+ }
45
+
42
46
const { publish } = netlifyConfig . build
43
47
if ( shouldSkip ( ) ) {
44
48
await restoreCache ( { cache, publish } )
@@ -65,7 +69,7 @@ const plugin: NetlifyPlugin = {
65
69
build : { failBuild } ,
66
70
} ,
67
71
} ) {
68
- if ( shouldSkip ( ) ) {
72
+ if ( isOldPluginInstalled ( ) || shouldSkip ( ) ) {
69
73
return
70
74
}
71
75
const { publish } = netlifyConfig . build
@@ -178,6 +182,14 @@ const plugin: NetlifyPlugin = {
178
182
} ) {
179
183
await saveCache ( { cache, publish } )
180
184
185
+ if ( isOldPluginInstalled ( ) ) {
186
+ status . show ( {
187
+ summary :
188
+ 'Please remove @netlify/plugin-nextjs from your site. It is no longer required and will prevent you using new features.' ,
189
+ } )
190
+ return
191
+ }
192
+
181
193
if ( shouldSkip ( ) ) {
182
194
status . show ( {
183
195
title : 'Essential Next.js plugin did not run' ,
0 commit comments