-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve support for new requireHooks update (#2313)
* fix: make sure appDir exists before running requireHooks * fix: run prebundledReact if appDir exists in conf * fix: use ExperimentalConfigWithLegacy for appDir * fix: set cache to manual and env as optional * fix: prettier * fix: update appDir check * fix: styled-jsx solution for 13.5 * test: add styled-jsx to included files test * test: added next latest to i18n for testing * fix: remove i18n for wp * fix: use requireHooks based on next -v and appDir * fix: remove fs-extra * fix: add semver to handler * fix: try to import semver * fix: testing something new * fix: reset * fix: add back useHooks * fix: test updates + remove preRender update * test: add useHooks * refactor: use existing resolveModuleRoot function instead of module.createRequire * fix: remove 13.5 --------- Co-authored-by: Michal Piechowiak <[email protected]> Co-authored-by: Rob Stanford <[email protected]>
- Loading branch information
1 parent
b3be3f8
commit e354b73
Showing
12 changed files
with
80 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ import { getRequiredServerFiles, NextConfig } from './config' | |
import { getPluginVersion } from './functionsMetaData' | ||
import { makeLocaleOptional, stripLookahead, transformCaptureGroups } from './matchers' | ||
import { RoutesManifest } from './types' | ||
|
||
// This is the format as of [email protected] | ||
interface EdgeFunctionDefinitionV1 { | ||
env: string[] | ||
|
@@ -38,7 +39,7 @@ export interface MiddlewareMatcher { | |
|
||
// This is the format after [email protected] | ||
interface EdgeFunctionDefinitionV2 { | ||
env: string[] | ||
env?: string[] | ||
files: string[] | ||
name: string | ||
page: string | ||
|
@@ -376,7 +377,6 @@ export const writeEdgeFunctions = async ({ | |
const { publish } = netlifyConfig.build | ||
const nextConfigFile = await getRequiredServerFiles(publish) | ||
const nextConfig = nextConfigFile.config | ||
const usesAppDir = nextConfig.experimental?.appDir | ||
|
||
await copy(getEdgeTemplatePath('../vendor'), join(edgeFunctionRoot, 'vendor')) | ||
await copy(getEdgeTemplatePath('../edge-shared'), join(edgeFunctionRoot, 'edge-shared')) | ||
|
@@ -462,8 +462,7 @@ export const writeEdgeFunctions = async ({ | |
function: functionName, | ||
name: edgeFunctionDefinition.name, | ||
pattern, | ||
// cache: "manual" is currently experimental, so we restrict it to sites that use experimental appDir | ||
cache: usesAppDir ? 'manual' : undefined, | ||
cache: 'manual', | ||
generator, | ||
}) | ||
// pages-dir page routes also have a data route. If there's a match, add an entry mapping that to the function too | ||
|
@@ -473,7 +472,7 @@ export const writeEdgeFunctions = async ({ | |
function: functionName, | ||
name: edgeFunctionDefinition.name, | ||
pattern: dataRoute, | ||
cache: usesAppDir ? 'manual' : undefined, | ||
cache: 'manual', | ||
generator, | ||
}) | ||
} | ||
|
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
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