Use Edge Runtime for running Edge Functions locally (#37024)
This PR introduces [Edge Runtime](https://edge-runtime.vercel.app/) for emulating [Edge Functions](https://vercel.com/features/edge-functions) locally. Every time you run a [middleware](https://nextjs.org/docs/advanced-features/middleware) locally via `next dev`, an isolated edge runtime context will be created. These contexts have the same constraints as production servers, plus they don't pollute the global scope; Instead, all the code run in a vm on top of a Node.js process. Additionally, `@edge-runtime/jest-environment` has been added to make easier testing Edge Functions in a programmatic way. It dropped the following polyfills from Next.js codebase, since they are now part of Edge Runtime: - abort-controller - formdata - uuid - web-crypto - web-streams Co-authored-by:Gal Schlezinger <2054772+Schniz@users.noreply.github.com>
Showing
| ... | @@ -54,6 +54,7 @@ | ... | @@ -54,6 +54,7 @@ |
| "@babel/plugin-proposal-object-rest-spread": "7.14.7", | "@babel/plugin-proposal-object-rest-spread": "7.14.7", | ||
| "@babel/preset-flow": "7.14.5", | "@babel/preset-flow": "7.14.5", | ||
| "@babel/preset-react": "7.14.5", | "@babel/preset-react": "7.14.5", | ||
| "@edge-runtime/jest-environment": "1.0.1-beta.10", | |||
| "@fullhuman/postcss-purgecss": "1.3.0", | "@fullhuman/postcss-purgecss": "1.3.0", | ||
| "@mdx-js/loader": "0.18.0", | "@mdx-js/loader": "0.18.0", | ||
| "@next/bundle-analyzer": "workspace:*", | "@next/bundle-analyzer": "workspace:*", | ||
| ... | @@ -191,7 +192,6 @@ | ... | @@ -191,7 +192,6 @@ |
| "turbo": "1.2.9", | "turbo": "1.2.9", | ||
| "typescript": "4.6.3", | "typescript": "4.6.3", | ||
| "wait-port": "0.2.2", | "wait-port": "0.2.2", | ||
| "web-streams-polyfill": "2.1.1", | |||
| "webpack": "link:./node_modules/webpack5", | "webpack": "link:./node_modules/webpack5", | ||
| "webpack-bundle-analyzer": "4.3.0", | "webpack-bundle-analyzer": "4.3.0", | ||
| "worker-loader": "3.0.7" | "worker-loader": "3.0.7" | ||
| ... | ... |
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Please
register
or
sign in
to comment