-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix build worker callback arg missing correct page path (#61347)
### What The `arg` in the worker callback is alwasy `any`, when we access the page path the argument could be in different form as the arg types are different. This PR align the argument type to object for `isPageStatic`, `getDefinedNamedExports`, `hasCustomGetInitialProps` methods in static worker. So they can share the similar shape of type of argument when accessing `page` path. This will avoid the case that logged `page` in the warning is `undefined` Import the helpers from utils instead of workers as the worker itself don't need to contain other exports that is not used for static worker. ### Why This PR align the callback type of callback argument type of static worker, so that we could get the actual page path value in a type-safe way. We have 4 methods for static worker, `exportPage`, `isPageStatic`, `getDefinedNamedExports`, `hasCustomGetInitialProps`, which the rest of 3 methods share the same format of warnings but their argument are different. It's easily ended up with wrong argument type, and log with a bad page path in the warning. Closes NEXT-2289
- Loading branch information
Showing
6 changed files
with
57 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
import '../server/require-hook' | ||
|
||
export * from './utils' | ||
export { | ||
getDefinedNamedExports, | ||
hasCustomGetInitialProps, | ||
isPageStatic, | ||
} from './utils' | ||
import exportPage from '../export/worker' | ||
export { exportPage } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters