@netlify/plugin-nextjs 4.28.2-appdir.0 → 4.28.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.writeEdgeFunctions = exports.writeDevEdgeFunction = exports.cleanupEdgeFunctions = exports.loadAppPathRoutesManifest = exports.loadMiddlewareManifest = void 0;
6
+ exports.writeEdgeFunctions = exports.writeDevEdgeFunction = exports.cleanupEdgeFunctions = exports.loadMiddlewareManifest = void 0;
7
7
  /* eslint-disable max-lines */
8
8
  const fs_1 = require("fs");
9
9
  const path_1 = require("path");
@@ -13,15 +13,14 @@ const fs_extra_1 = require("fs-extra");
13
13
  const outdent_1 = require("outdent");
14
14
  const config_1 = require("./config");
15
15
  const matchers_1 = require("./matchers");
16
- const maybeLoadJson = (path) => {
17
- if ((0, fs_1.existsSync)(path)) {
18
- return (0, fs_extra_1.readJson)(path);
16
+ const loadMiddlewareManifest = (netlifyConfig) => {
17
+ const middlewarePath = (0, path_1.resolve)(netlifyConfig.build.publish, 'server', 'middleware-manifest.json');
18
+ if (!(0, fs_1.existsSync)(middlewarePath)) {
19
+ return null;
19
20
  }
21
+ return (0, fs_extra_1.readJson)(middlewarePath);
20
22
  };
21
- const loadMiddlewareManifest = (netlifyConfig) => maybeLoadJson((0, path_1.resolve)(netlifyConfig.build.publish, 'server', 'middleware-manifest.json'));
22
23
  exports.loadMiddlewareManifest = loadMiddlewareManifest;
23
- const loadAppPathRoutesManifest = (netlifyConfig) => maybeLoadJson((0, path_1.resolve)(netlifyConfig.build.publish, 'app-path-routes-manifest.json'));
24
- exports.loadAppPathRoutesManifest = loadAppPathRoutesManifest;
25
24
  /**
26
25
  * Convert the Next middleware name into a valid Edge Function name
27
26
  */
@@ -96,7 +95,7 @@ const getMiddlewareBundle = async ({ edgeFunctionDefinition, netlifyConfig, }) =
96
95
  };
97
96
  const getEdgeTemplatePath = (file) => (0, path_1.join)(__dirname, '..', '..', 'src', 'templates', 'edge', file);
98
97
  const copyEdgeSourceFile = ({ file, target, edgeFunctionDir, }) => fs_1.promises.copyFile(getEdgeTemplatePath(file), (0, path_1.join)(edgeFunctionDir, target !== null && target !== void 0 ? target : file));
99
- const writeEdgeFunction = async ({ edgeFunctionDefinition, edgeFunctionRoot, netlifyConfig, pageRegexMap, appPathRoutesManifest = {}, nextConfig, }) => {
98
+ const writeEdgeFunction = async ({ edgeFunctionDefinition, edgeFunctionRoot, netlifyConfig, nextConfig, }) => {
100
99
  const name = sanitizeName(edgeFunctionDefinition.name);
101
100
  const edgeFunctionDir = (0, path_1.join)(edgeFunctionRoot, name);
102
101
  const bundle = await getMiddlewareBundle({
@@ -124,14 +123,6 @@ const writeEdgeFunction = async ({ edgeFunctionDefinition, edgeFunctionRoot, net
124
123
  else {
125
124
  matchers.push(...edgeFunctionDefinition.matchers);
126
125
  }
127
- // If the EF matches a page, it's an app dir page so needs a matcher too
128
- // The object will be empty if appDir isn't enabled in the Next config
129
- if (pageRegexMap && edgeFunctionDefinition.page in appPathRoutesManifest) {
130
- const regexp = pageRegexMap.get(appPathRoutesManifest[edgeFunctionDefinition.page]);
131
- if (regexp) {
132
- matchers.push({ regexp });
133
- }
134
- }
135
126
  await (0, fs_extra_1.writeJson)((0, path_1.join)(edgeFunctionDir, 'matchers.json'), matchers);
136
127
  // We add a defintion for each matching path
137
128
  return matchers.map((matcher) => {
@@ -164,7 +155,7 @@ exports.writeDevEdgeFunction = writeDevEdgeFunction;
164
155
  /**
165
156
  * Writes Edge Functions for the Next middleware
166
157
  */
167
- const writeEdgeFunctions = async ({ netlifyConfig, routesManifest, }) => {
158
+ const writeEdgeFunctions = async (netlifyConfig) => {
168
159
  const manifest = {
169
160
  functions: [],
170
161
  version: 1,
@@ -211,20 +202,12 @@ const writeEdgeFunctions = async ({ netlifyConfig, routesManifest, }) => {
211
202
  // Older versions of the manifest format don't have the functions field
212
203
  // No, the version field was not incremented
213
204
  if (typeof middlewareManifest.functions === 'object') {
214
- // When using the app dir, we also need to check if the EF matches a page
215
- const appPathRoutesManifest = await (0, exports.loadAppPathRoutesManifest)(netlifyConfig);
216
- const pageRegexMap = new Map([...(routesManifest.dynamicRoutes || []), ...(routesManifest.staticRoutes || [])].map((route) => [
217
- route.page,
218
- route.regex,
219
- ]));
220
205
  for (const edgeFunctionDefinition of Object.values(middlewareManifest.functions)) {
221
206
  usesEdge = true;
222
207
  const functionDefinitions = await writeEdgeFunction({
223
208
  edgeFunctionDefinition,
224
209
  edgeFunctionRoot,
225
210
  netlifyConfig,
226
- pageRegexMap,
227
- appPathRoutesManifest,
228
211
  nextConfig,
229
212
  });
230
213
  manifest.functions.push(...functionDefinitions);
@@ -70,6 +70,7 @@ exports.getMiddleware = getMiddleware;
70
70
  const moveStaticPages = async ({ netlifyConfig, target, i18n, basePath, }) => {
71
71
  console.log('Moving static page files to serve from CDN...');
72
72
  const outputDir = (0, pathe_1.join)(netlifyConfig.build.publish, target === 'server' ? 'server' : 'serverless');
73
+ const root = (0, pathe_1.join)(outputDir, 'pages');
73
74
  const buildId = (0, fs_extra_1.readFileSync)((0, pathe_1.join)(netlifyConfig.build.publish, 'BUILD_ID'), 'utf8').trim();
74
75
  const dataDir = (0, pathe_1.join)('_next', 'data', buildId);
75
76
  await (0, fs_extra_1.ensureDir)((0, pathe_1.join)(netlifyConfig.build.publish, dataDir));
@@ -91,17 +92,14 @@ const moveStaticPages = async ({ netlifyConfig, target, i18n, basePath, }) => {
91
92
  }
92
93
  }
93
94
  });
94
- let fileCount = 0;
95
+ const files = [];
95
96
  const filesManifest = {};
96
97
  const moveFile = async (file) => {
97
- // Strip the initial 'app' or 'pages' directory from the output path
98
- const pathname = file.split('/').slice(1).join('/');
99
- // .rsc data files go next to the html file
100
98
  const isData = file.endsWith('.json');
101
- const source = (0, pathe_1.join)(outputDir, file);
102
- const targetFile = isData ? (0, pathe_1.join)(dataDir, pathname) : pathname;
99
+ const source = (0, pathe_1.join)(root, file);
100
+ const targetFile = isData ? (0, pathe_1.join)(dataDir, file) : file;
103
101
  const targetPath = basePath ? (0, pathe_1.join)(basePath, targetFile) : targetFile;
104
- fileCount += 1;
102
+ files.push(file);
105
103
  filesManifest[file] = targetPath;
106
104
  const dest = (0, pathe_1.join)(netlifyConfig.build.publish, targetPath);
107
105
  try {
@@ -112,8 +110,8 @@ const moveStaticPages = async ({ netlifyConfig, target, i18n, basePath, }) => {
112
110
  }
113
111
  };
114
112
  // Move all static files, except error documents and nft manifests
115
- const pages = await (0, globby_1.default)(['{app,pages}/**/*.{html,json,rsc}', '!**/(500|404|*.js.nft).{html,json}'], {
116
- cwd: outputDir,
113
+ const pages = await (0, globby_1.default)(['**/*.{html,json}', '!**/(500|404|*.js.nft).{html,json}'], {
114
+ cwd: root,
117
115
  dot: true,
118
116
  });
119
117
  const matchingMiddleware = new Set();
@@ -151,7 +149,7 @@ const moveStaticPages = async ({ netlifyConfig, target, i18n, basePath, }) => {
151
149
  return limit(moveFile, filePath);
152
150
  });
153
151
  await Promise.all(promises);
154
- console.log(`Moved ${fileCount} files`);
152
+ console.log(`Moved ${files.length} files`);
155
153
  if (matchedPages.size !== 0) {
156
154
  console.log((0, chalk_1.yellowBright)((0, outdent_1.outdent) `
157
155
  Skipped moving ${matchedPages.size} ${matchedPages.size === 1 ? 'file because it matches' : 'files because they match'} middleware, so cannot be deployed to the CDN and will be served from the origin instead.
@@ -20,13 +20,10 @@ const utils_1 = require("./utils");
20
20
  const generateFunctions = async ({ FUNCTIONS_SRC = constants_1.DEFAULT_FUNCTIONS_SRC, INTERNAL_FUNCTIONS_SRC, PUBLISH_DIR }, appDir, apiRoutes) => {
21
21
  const publish = (0, pathe_1.resolve)(PUBLISH_DIR);
22
22
  const functionsDir = (0, pathe_1.resolve)(INTERNAL_FUNCTIONS_SRC || FUNCTIONS_SRC);
23
+ console.log({ functionsDir });
23
24
  const functionDir = (0, pathe_1.join)(functionsDir, constants_1.HANDLER_FUNCTION_NAME);
24
25
  const publishDir = (0, pathe_1.relative)(functionDir, publish);
25
26
  for (const { route, config, compiled } of apiRoutes) {
26
- // Don't write a lambda if the runtime is edge
27
- if (config.runtime === 'experimental-edge') {
28
- continue;
29
- }
30
27
  const apiHandlerSource = await (0, getApiHandler_1.getApiHandler)({
31
28
  page: route,
32
29
  config,
package/lib/index.js CHANGED
@@ -44,7 +44,7 @@ const plugin = {
44
44
  }
45
45
  const { publish } = netlifyConfig.build;
46
46
  (0, verification_1.checkNextSiteHasBuilt)({ publish, failBuild });
47
- const { appDir, basePath, i18n, images, target, ignore, trailingSlash, outdir, experimental, routesManifest } = await (0, config_1.getNextConfig)({
47
+ const { appDir, basePath, i18n, images, target, ignore, trailingSlash, outdir, experimental } = await (0, config_1.getNextConfig)({
48
48
  publish,
49
49
  failBuild,
50
50
  });
@@ -118,7 +118,7 @@ const plugin = {
118
118
  buildId,
119
119
  apiRoutes,
120
120
  });
121
- await (0, edge_1.writeEdgeFunctions)({ netlifyConfig, routesManifest });
121
+ await (0, edge_1.writeEdgeFunctions)(netlifyConfig);
122
122
  },
123
123
  async onPostBuild({ netlifyConfig: { build: { publish }, redirects, headers, }, utils: { status, cache, functions, build: { failBuild }, }, constants: { FUNCTIONS_DIST }, }) {
124
124
  await (0, cache_1.saveCache)({ cache, publish });
@@ -107,7 +107,7 @@ const getApiHandler = ({ page, config, publishDir = '../../../.next', appDir = '
107
107
  const { config } = require("${publishDir}/required-server-files.json")
108
108
  let staticManifest
109
109
  const path = require("path");
110
- const pageRoot = path.resolve(path.join(__dirname, "${publishDir}", "server"));
110
+ const pageRoot = path.resolve(path.join(__dirname, "${publishDir}", "serverless", "pages"));
111
111
  const handler = (${makeHandler.toString()})(config, "${appDir}", pageRoot, ${JSON.stringify(page)})
112
112
  exports.handler = ${config.type === "experimental-scheduled" /* ApiRouteType.SCHEDULED */ ? `schedule(${JSON.stringify(config.schedule)}, handler);` : 'handler'}
113
113
  `;
@@ -15,7 +15,6 @@ const { augmentFsModule, getMaxAge, getMultiValueHeaders, getNextServer } = requ
15
15
  // eslint-disable-next-line max-params
16
16
  const makeHandler = (conf, app, pageRoot, staticManifest = [], mode = 'ssr') => {
17
17
  var _a;
18
- console.log('makeHandler', process.env);
19
18
  // Change working directory into the site root, unless using Nx, which moves the
20
19
  // dist directory and handles this itself
21
20
  const dir = path.resolve(__dirname, app);
@@ -38,7 +37,9 @@ const makeHandler = (conf, app, pageRoot, staticManifest = [], mode = 'ssr') =>
38
37
  for (const [key, value] of Object.entries(conf.env)) {
39
38
  process.env[key] = String(value);
40
39
  }
41
- augmentFsModule({ promises, staticManifest, pageRoot });
40
+ // Set during the request as it needs the host header. Hoisted so we can define the function once
41
+ let base;
42
+ augmentFsModule({ promises, staticManifest, pageRoot, getBase: () => base });
42
43
  // We memoize this because it can be shared between requests, but don't instantiate it until
43
44
  // the first request because we need the host and port.
44
45
  let bridge;
@@ -48,6 +49,9 @@ const makeHandler = (conf, app, pageRoot, staticManifest = [], mode = 'ssr') =>
48
49
  }
49
50
  const url = new URL(event.rawUrl);
50
51
  const port = Number.parseInt(url.port) || 80;
52
+ const { host } = event.headers;
53
+ const protocol = event.headers['x-forwarded-proto'] || 'http';
54
+ base = `${protocol}://${host}`;
51
55
  const NextServer = getNextServer();
52
56
  const nextServer = new NextServer({
53
57
  conf,
@@ -72,8 +76,6 @@ const makeHandler = (conf, app, pageRoot, staticManifest = [], mode = 'ssr') =>
72
76
  };
73
77
  return async function handler(event, context) {
74
78
  var _a, _b, _c;
75
- const baseUrl = process.env.CONTEXT === 'production' ? process.env.URL : process.env.DEPLOY_PRIME_URL;
76
- console.log('Using baseUrl', baseUrl, process.env);
77
79
  let requestMode = mode;
78
80
  // Ensure that paths are encoded - but don't double-encode them
79
81
  event.path = new URL(event.rawUrl).pathname;
@@ -140,7 +142,7 @@ const getHandler = ({ isODB = false, publishDir = '../../../.next', appDir = '..
140
142
  staticManifest = require("${publishDir}/static-manifest.json")
141
143
  } catch {}
142
144
  const path = require("path");
143
- const pageRoot = path.resolve(path.join(__dirname, "${publishDir}", "server"));
145
+ const pageRoot = path.resolve(path.join(__dirname, "${publishDir}", config.target === "server" ? "server" : "serverless", "pages"));
144
146
  exports.handler = ${isODB
145
147
  ? `builder((${makeHandler.toString()})(config, "${appDir}", pageRoot, staticManifest, 'odb'));`
146
148
  : `(${makeHandler.toString()})(config, "${appDir}", pageRoot, staticManifest, 'ssr');`}
@@ -5,31 +5,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getSinglePageResolver = exports.getPageResolver = void 0;
7
7
  const path_1 = require("path");
8
- const fs_extra_1 = require("fs-extra");
9
- const globby_1 = __importDefault(require("globby"));
10
8
  const outdent_1 = require("outdent");
11
9
  const pathe_1 = require("pathe");
12
10
  const slash_1 = __importDefault(require("slash"));
11
+ const tiny_glob_1 = __importDefault(require("tiny-glob"));
13
12
  const constants_1 = require("../constants");
14
13
  const files_1 = require("../helpers/files");
15
14
  // Generate a file full of require.resolve() calls for all the pages in the
16
15
  // build. This is used by the nft bundler to find all the pages.
17
16
  const getPageResolver = async ({ publish, target }) => {
18
- const functionDir = (0, path_1.resolve)((0, path_1.join)('.netlify', 'functions', constants_1.HANDLER_FUNCTION_NAME));
19
- const root = (0, path_1.resolve)((0, slash_1.default)(publish), target === 'server' ? 'server' : 'serverless');
20
- const pages = await (0, globby_1.default)('{pages,app}/**/*.js.nft.json', {
17
+ const functionDir = path_1.posix.resolve(path_1.posix.join('.netlify', 'functions', constants_1.HANDLER_FUNCTION_NAME));
18
+ const root = path_1.posix.resolve((0, slash_1.default)(publish), target === 'server' ? 'server' : 'serverless', 'pages');
19
+ const pages = await (0, tiny_glob_1.default)('**/*.js', {
21
20
  cwd: root,
22
21
  dot: true,
23
22
  });
24
- const dependencies = await Promise.all(pages.map(async (page) => {
25
- const dir = (0, path_1.dirname)(page);
26
- const { files } = await (0, fs_extra_1.readJSON)((0, path_1.join)(root, page));
27
- return files === null || files === void 0 ? void 0 : files.map((file) => (0, path_1.resolve)(root, dir, file));
28
- }));
29
- const deduped = [...new Set(dependencies.flat())];
30
- const pageFiles = deduped.map((file) => `require.resolve('${(0, pathe_1.relative)(functionDir, file)}')`).sort();
23
+ const pageFiles = pages
24
+ .map((page) => `require.resolve('${path_1.posix.relative(functionDir, path_1.posix.join(root, (0, slash_1.default)(page)))}')`)
25
+ .sort();
31
26
  return (0, outdent_1.outdent) `
32
- // This file is purely to allow nft to know about these pages.
27
+ // This file is purely to allow nft to know about these pages. It should be temporary.
33
28
  exports.resolvePages = () => {
34
29
  try {
35
30
  ${pageFiles.join('\n ')}
@@ -5,12 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getNextServer = exports.augmentFsModule = exports.getMultiValueHeaders = exports.getMaxAge = exports.downloadFile = void 0;
7
7
  const fs_1 = require("fs");
8
- const http_1 = __importDefault(require("http"));
9
- const https_1 = __importDefault(require("https"));
10
8
  const os_1 = require("os");
11
9
  const path_1 = __importDefault(require("path"));
12
10
  const stream_1 = require("stream");
13
11
  const util_1 = require("util");
12
+ const follow_redirects_1 = require("follow-redirects");
14
13
  const streamPipeline = (0, util_1.promisify)(stream_1.pipeline);
15
14
  /**
16
15
  * Downloads a file from the CDN to the local aliased filesystem. This is a fallback, because in most cases we'd expect
@@ -18,14 +17,9 @@ const streamPipeline = (0, util_1.promisify)(stream_1.pipeline);
18
17
  */
19
18
  const downloadFile = async (url, destination) => {
20
19
  console.log(`Downloading ${url} to ${destination}`);
21
- const httpx = url.startsWith('https') ? https_1.default : http_1.default;
20
+ const httpx = url.startsWith('https') ? follow_redirects_1.https : follow_redirects_1.http;
22
21
  await new Promise((resolve, reject) => {
23
- const req = httpx.get(url, {
24
- timeout: 10000,
25
- headers: {
26
- 'x-nf-next-asset-req': 'true',
27
- },
28
- }, (response) => {
22
+ const req = httpx.get(url, { timeout: 10000, maxRedirects: 1 }, (response) => {
29
23
  if (response.statusCode < 200 || response.statusCode > 299) {
30
24
  reject(new Error(`Failed to download ${url}: ${response.statusCode} ${response.statusMessage || ''}`));
31
25
  return;
@@ -81,7 +75,7 @@ exports.getMultiValueHeaders = getMultiValueHeaders;
81
75
  /**
82
76
  * Monkey-patch the fs module to download missing files from the CDN
83
77
  */
84
- const augmentFsModule = ({ promises, staticManifest, pageRoot, }) => {
78
+ const augmentFsModule = ({ promises, staticManifest, pageRoot, getBase, }) => {
85
79
  // Only do this if we have some static files moved to the CDN
86
80
  if (staticManifest.length === 0) {
87
81
  return;
@@ -99,24 +93,22 @@ const augmentFsModule = ({ promises, staticManifest, pageRoot, }) => {
99
93
  const statsOrig = promises.stat;
100
94
  // ...then money-patch it to see if it's requesting a CDN file
101
95
  promises.readFile = (async (file, options) => {
102
- // In production use the public URL (e.g. https://example.com). Otherwise use the deploy URL, e.g. https://deploy-preview-123--example.netlify.app
103
- const baseUrl = process.env.CONTEXT === 'production' ? process.env.URL : process.env.DEPLOY_PRIME_URL;
104
- console.log('Using baseUrl', baseUrl);
96
+ const base = getBase();
105
97
  // We only care about page files
106
98
  if (file.startsWith(pageRoot)) {
107
- // We only want the part after `.next/server/`
99
+ // We only want the part after `pages/`
108
100
  const filePath = file.slice(pageRoot.length + 1);
109
101
  // Is it in the CDN and not local?
110
102
  if (staticFiles.has(filePath) && !(0, fs_1.existsSync)(file)) {
111
103
  // This name is safe to use, because it's one that was already created by Next
112
104
  const cacheFile = path_1.default.join(cacheDir, filePath);
113
- const url = `${baseUrl}/${staticFiles.get(filePath)}`;
105
+ const url = `${base}/${staticFiles.get(filePath)}`;
114
106
  // If it's already downloading we can wait for it to finish
115
107
  if (downloadPromises.has(url)) {
116
108
  await downloadPromises.get(url);
117
109
  }
118
110
  // Have we already cached it? We download every time if running locally to avoid staleness
119
- if ((!(0, fs_1.existsSync)(cacheFile) || process.env.NETLIFY_DEV) && baseUrl) {
111
+ if ((!(0, fs_1.existsSync)(cacheFile) || process.env.NETLIFY_DEV) && base) {
120
112
  await promises.mkdir(path_1.default.dirname(cacheFile), { recursive: true });
121
113
  try {
122
114
  // Append the path to our host and we can load it like a regular page
@@ -137,7 +129,7 @@ const augmentFsModule = ({ promises, staticManifest, pageRoot, }) => {
137
129
  promises.stat = ((file, options) => {
138
130
  // We only care about page files
139
131
  if (file.startsWith(pageRoot)) {
140
- // We only want the part after `.next/server`
132
+ // We only want the part after `pages/`
141
133
  const cacheFile = path_1.default.join(cacheDir, file.slice(pageRoot.length + 1));
142
134
  if ((0, fs_1.existsSync)(cacheFile)) {
143
135
  return statsOrig(cacheFile, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/plugin-nextjs",
3
- "version": "4.28.2-appdir.0",
3
+ "version": "4.28.2",
4
4
  "description": "Run Next.js seamlessly on Netlify",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -18,6 +18,7 @@
18
18
  "chalk": "^4.1.2",
19
19
  "destr": "^1.1.1",
20
20
  "execa": "^5.1.1",
21
+ "follow-redirects": "^1.15.2",
21
22
  "fs-extra": "^10.0.0",
22
23
  "globby": "^11.0.4",
23
24
  "merge-stream": "^2.0.0",
@@ -13,12 +13,6 @@ export interface FetchEventResult {
13
13
  waitUntil: Promise<any>
14
14
  }
15
15
 
16
- export interface I18NConfig {
17
- defaultLocale: string
18
- localeDetection?: false
19
- locales: string[]
20
- }
21
-
22
16
  export interface RequestData {
23
17
  geo?: {
24
18
  city?: string
@@ -32,7 +26,7 @@ export interface RequestData {
32
26
  method: string
33
27
  nextConfig?: {
34
28
  basePath?: string
35
- i18n?: I18NConfig | null
29
+ i18n?: Record<string, unknown>
36
30
  trailingSlash?: boolean
37
31
  }
38
32
  page?: {
@@ -56,10 +50,10 @@ declare global {
56
50
  globalThis.NFRequestContextMap ||= new Map()
57
51
 
58
52
  const handler = async (req: Request, context: Context) => {
59
- // if (Deno.env.get('NETLIFY_DEV')) {
60
- // // Don't run in dev
61
- // return
62
- // }
53
+ if (Deno.env.get('NETLIFY_DEV')) {
54
+ // Don't run in dev
55
+ return
56
+ }
63
57
 
64
58
  const url = new URL(req.url)
65
59