@@ -15,7 +15,7 @@ const isStaticExportProject = require('./helpers/isStaticExportProject');
15
15
// - Between the build and postbuild steps, any functions are bundled
16
16
17
17
module . exports = {
18
- async onPreBuild ( { constants , netlifyConfig , utils } ) {
18
+ async onPreBuild ( { netlifyConfig , packageJson : { scripts = { } , dependencies = { } } , utils } ) {
19
19
if ( ! ( await hasFramework ( 'next' ) ) ) {
20
20
return failBuild ( `This application does not use Next.js.` ) ;
21
21
}
@@ -27,21 +27,6 @@ module.exports = {
27
27
// the next-on-netlify function template
28
28
await utils . run . command ( 'npm install next-on-netlify@latest' ) ;
29
29
30
- // Require the project's package.json for access to its scripts
31
- // and dependencies in order to check existing project configuration
32
- let packageJson ;
33
- if ( existsSync ( path . resolve ( constants . PUBLISH_DIR , 'package.json' ) ) ) {
34
- packageJson = require ( path . resolve ( constants . PUBLISH_DIR , 'package.json' ) ) ;
35
- } else if ( existsSync ( path . resolve ( constants . PUBLISH_DIR , '..' , 'package.json' ) ) ) {
36
- packageJson = require ( path . resolve ( constants . PUBLISH_DIR , '..' , 'package.json' ) ) ;
37
- } else {
38
- failBuild ( `Cannot locate your package.json file. Please make sure your package.json is
39
- at the root of your project or in your publish directory.`
40
- ) ;
41
- }
42
-
43
- const { scripts, dependencies } = packageJson ;
44
-
45
30
if ( isStaticExportProject ( { build, scripts } ) ) {
46
31
failBuild ( `** Static HTML export next.js projects do not require this plugin **` ) ;
47
32
}
0 commit comments