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'
12import chalk from 'next/dist/compiled/chalk'
23import getGzipSize from 'next/dist/compiled/gzip-size'
34import textTable from 'next/dist/compiled/text-table'
Original file line number Diff line number Diff line change 1+ import './node-polyfill-fetch'
12import type { Params , Route } from './router'
23import type { CacheFs } from '../shared/lib/utils'
34import 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 ) => {
22 console . log ( req . url , 'query' , req . query )
33 res . json ( {
44 url : req . url ,
55 query : req . query ,
6+ // make sure fetch if polyfilled
7+ example : await fetch ( 'https://example.com' ) . then ( ( res ) => res . text ( ) ) ,
68 } )
79}
Original file line number Diff line number Diff line change @@ -10,7 +10,10 @@ export const getStaticProps = ({ params }) => {
1010 }
1111}
1212
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+
1417 return {
1518 paths : [ '/fallback/first' ] ,
1619 fallback : true ,
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ export async function getServerSideProps({ res }) {
1919 props : {
2020 hello : 'world' ,
2121 data,
22+ // make sure fetch if polyfilled
23+ example : await fetch ( 'https://example.com' ) . then ( ( res ) => res . text ( ) ) ,
2224 } ,
2325 }
2426}
You can’t perform that action at this time.
0 commit comments