@@ -5,6 +5,7 @@ const util = require('util')
5
5
const findUp = require ( 'find-up' )
6
6
const makeDir = require ( 'make-dir' )
7
7
8
+ const { name : pluginName } = require ( './package.json' )
8
9
const isStaticExportProject = require ( './helpers/isStaticExportProject' )
9
10
const validateNextUsage = require ( './helpers/validateNextUsage' )
10
11
@@ -25,7 +26,7 @@ module.exports = {
25
26
}
26
27
27
28
const { build } = netlifyConfig
28
- const { scripts = { } , dependencies = { } } = packageJson
29
+ const { name , scripts = { } , dependencies = { } } = packageJson
29
30
30
31
if ( isStaticExportProject ( { build, scripts } ) ) {
31
32
return failBuild ( `** Static HTML export next.js projects do not require this plugin **` )
@@ -34,7 +35,8 @@ module.exports = {
34
35
const hasNextOnNetlifyInstalled = dependencies [ 'next-on-netlify' ] !== undefined
35
36
const hasNextOnNetlifyPostbuildScript =
36
37
typeof scripts . postbuild === 'string' && scripts . postbuild . includes ( 'next-on-netlify' )
37
- const isAlreadyUsingNextOnNetlify = hasNextOnNetlifyInstalled || hasNextOnNetlifyPostbuildScript
38
+ const isAlreadyUsingNextOnNetlify =
39
+ ( hasNextOnNetlifyInstalled || hasNextOnNetlifyPostbuildScript ) && pluginName !== name
38
40
if ( isAlreadyUsingNextOnNetlify ) {
39
41
return failBuild (
40
42
`This plugin does not support sites that manually use next-on-netlify. Uninstall next-on-netlify as a dependency to resolve.` ,
0 commit comments