@@ -166,7 +166,7 @@ exports.moveStaticPages = async ({ netlifyConfig, target, i18n }) => {
166
166
yellowBright ( outdent `
167
167
Skipped moving ${ matchedPages . size } ${
168
168
matchedPages . size === 1 ? 'file because it matches' : 'files because they match'
169
- } middleware, so cannot be deployed to the CDN and will be served from the origin instead.
169
+ } middleware, so cannot be deployed to the CDN and will be served from the origin instead.
170
170
This is fine, but we're letting you know because it may not be what you expect.
171
171
` ) ,
172
172
)
@@ -301,8 +301,14 @@ exports.unpatchNextFiles = async (root) => {
301
301
}
302
302
}
303
303
304
- exports . movePublicFiles = async ( { appDir, publish } ) => {
305
- const publicDir = join ( appDir , 'public' )
304
+ exports . movePublicFiles = async ( { appDir, outdir, publish } ) => {
305
+ // `outdir` is a config property added when using Next.js with Nx. It's typically
306
+ // a relative path outside of the appDir, e.g. '../../dist/apps/<app-name>', and
307
+ // the parent directory of the .next directory.
308
+ // If it exists, copy the files from the public folder there in order to include
309
+ // any files that were generated during the build. Otherwise, copy the public
310
+ // directory from the original app directory.
311
+ const publicDir = outdir ? join ( appDir , outdir , 'public' ) : join ( appDir , 'public' )
306
312
if ( existsSync ( publicDir ) ) {
307
313
await copy ( publicDir , `${ publish } /` )
308
314
}
0 commit comments