1
1
// @ts -check
2
2
const { readJSON } = require ( 'fs-extra' )
3
- const { join, dirname, relative } = require ( 'pathe' )
3
+ const { join, dirname, relative, normalize } = require ( 'pathe' )
4
4
5
5
const defaultFailBuild = ( message , { error } ) => {
6
6
throw new Error ( `${ message } \n${ error && error . stack } ` )
@@ -111,7 +111,15 @@ exports.getNextConfig = async function getNextConfig({ publish, failBuild = defa
111
111
112
112
const resolveModuleRoot = ( moduleName ) => {
113
113
try {
114
- return dirname ( relative ( process . cwd ( ) , require . resolve ( `${ moduleName } /package.json` , { paths : [ process . cwd ( ) ] } ) ) )
114
+ const modulePkg = require . resolve ( `${ moduleName } /package.json` , { paths : [ process . cwd ( ) ] } )
115
+ console . log ( 'resolving' , moduleName , process . cwd ( ) , normalize ( process . cwd ( ) ) , modulePkg , normalize ( modulePkg ) )
116
+
117
+ return dirname (
118
+ relative (
119
+ normalize ( process . cwd ( ) ) ,
120
+ normalize ( require . resolve ( `${ moduleName } /package.json` , { paths : [ process . cwd ( ) ] } ) ) ,
121
+ ) ,
122
+ )
115
123
} catch ( error ) {
116
124
return null
117
125
}
@@ -137,7 +145,6 @@ exports.configureHandlerFunctions = ({ netlifyConfig, publish, ignore = [] }) =>
137
145
const nextRoot = resolveModuleRoot ( 'next' )
138
146
if ( nextRoot ) {
139
147
netlifyConfig . functions [ functionName ] . included_files . push (
140
- `!${ nextRoot } /dist/pages/**/*` ,
141
148
`!${ nextRoot } /dist/server/lib/squoosh/**/*.wasm` ,
142
149
`!${ nextRoot } /dist/next-server/server/lib/squoosh/**/*.wasm` ,
143
150
`!${ nextRoot } /dist/compiled/webpack/bundle4.js` ,
0 commit comments