File tree Expand file tree Collapse file tree 5 files changed +11
-2
lines changed
test/production/required-server-files/pages Expand file tree Collapse file tree 5 files changed +11
-2
lines changed Original file line number Diff line number Diff line change
1
+ import '../server/node-polyfill-fetch'
1
2
import chalk from 'next/dist/compiled/chalk'
2
3
import getGzipSize from 'next/dist/compiled/gzip-size'
3
4
import textTable from 'next/dist/compiled/text-table'
Original file line number Diff line number Diff line change
1
+ import './node-polyfill-fetch'
1
2
import type { Params , Route } from './router'
2
3
import type { CacheFs } from '../shared/lib/utils'
3
4
import type { MiddlewareManifest } from '../build/webpack/plugins/middleware-plugin'
Original file line number Diff line number Diff line change 1
- export default ( req , res ) => {
1
+ export default async ( req , res ) => {
2
2
console . log ( req . url , 'query' , req . query )
3
3
res . json ( {
4
4
url : req . url ,
5
5
query : req . query ,
6
+ // make sure fetch if polyfilled
7
+ example : await fetch ( 'https://example.com' ) . then ( ( res ) => res . text ( ) ) ,
6
8
} )
7
9
}
Original file line number Diff line number Diff line change @@ -10,7 +10,10 @@ export const getStaticProps = ({ params }) => {
10
10
}
11
11
}
12
12
13
- export const getStaticPaths = ( ) => {
13
+ export const getStaticPaths = async ( ) => {
14
+ // make sure fetch if polyfilled
15
+ await fetch ( 'https://example.com' ) . then ( ( res ) => res . text ( ) )
16
+
14
17
return {
15
18
paths : [ '/fallback/first' ] ,
16
19
fallback : true ,
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ export async function getServerSideProps({ res }) {
19
19
props : {
20
20
hello : 'world' ,
21
21
data,
22
+ // make sure fetch if polyfilled
23
+ example : await fetch ( 'https://example.com' ) . then ( ( res ) => res . text ( ) ) ,
22
24
} ,
23
25
}
24
26
}
You can’t perform that action at this time.
0 commit comments