This repository was archived by the owner on Jan 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -124,15 +124,15 @@ class Builder {
124
124
join ( this . nextConfigDir , ".next/serverless/pages" ) ,
125
125
join ( this . outputDir , DEFAULT_LAMBDA_CODE_DIR , "pages" ) ,
126
126
{
127
- // skip api pages from default lambda code
128
- filter : file => {
129
- const isHTML = path . extname ( file ) === ".html " ;
130
- const isJSON = path . extname ( file ) === ".json" ;
127
+ filter : ( file : string ) => {
128
+ const isNotPrerenderedHTMLPage = path . extname ( file ) !== ".html" ;
129
+ const isNotStaticPropsJSONFile = path . extname ( file ) !== ".json " ;
130
+ const isNotApiPage = pathToPosix ( file ) . indexOf ( "pages/api" ) === - 1 ;
131
131
132
132
return (
133
- pathToPosix ( file ) . indexOf ( "pages/api" ) === - 1 &&
134
- ! isHTML &&
135
- ! isJSON
133
+ isNotApiPage &&
134
+ isNotPrerenderedHTMLPage &&
135
+ isNotStaticPropsJSONFile
136
136
) ;
137
137
}
138
138
}
Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ describe("Builder Tests", () => {
152
152
153
153
describe ( "Default Handler Artefact Files" , ( ) => {
154
154
it ( "copies build files" , async ( ) => {
155
- expect . assertions ( 5 ) ;
155
+ expect . assertions ( 7 ) ;
156
156
157
157
const files = await fse . readdir (
158
158
join ( outputDir , `${ DEFAULT_LAMBDA_CODE_DIR } ` )
@@ -185,7 +185,11 @@ describe("Builder Tests", () => {
185
185
// api pages should not be included in the default lambda
186
186
expect ( apiDirExists ) . toEqual ( false ) ;
187
187
188
- // html pages should not be included in the default lambda
188
+ // HTML Prerendered pages or JSON static props files
189
+ // should not be included in the default lambda
190
+ expect ( pages ) . not . toContain ( [ "blog.json" ] ) ;
191
+ expect ( pages ) . not . toContain ( [ "about.html" , "terms.html" ] ) ;
192
+
189
193
expect ( pages ) . toEqual ( [ "_error.js" , "blog.js" , "customers" ] ) ;
190
194
expect ( customerPages ) . toEqual ( [ "[...catchAll].js" , "[post].js" ] ) ;
191
195
} ) ;
You can’t perform that action at this time.
0 commit comments