@netlify/plugin-nextjs 4.17.1-runtime.2 → 4.17.1-runtime.5

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.
@@ -31,6 +31,7 @@ const onPreDev = async ({ constants, netlifyConfig }) => {
31
31
  `--bundle`,
32
32
  `--outdir=${(0, path_1.resolve)('.netlify')}`,
33
33
  `--format=esm`,
34
+ `--target=esnext`,
34
35
  '--watch',
35
36
  // Watch for both, because it can have either ts or js
36
37
  (0, path_1.resolve)(base, 'middleware.ts'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/plugin-nextjs",
3
- "version": "4.17.1-runtime.2",
3
+ "version": "4.17.1-runtime.5",
4
4
  "description": "Run Next.js seamlessly on Netlify",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@delucis/if-env": "^1.1.2",
33
- "@netlify/build": "^27.14.0",
33
+ "@netlify/build": "^27.15.0",
34
34
  "@types/fs-extra": "^9.0.13",
35
35
  "@types/jest": "^27.4.1",
36
36
  "@types/node": "^17.0.25",
@@ -1,5 +1,6 @@
1
- import { NextRequest, NextResponse } from 'https://esm.sh/next/server'
2
- import { fromFileUrl } from 'https://deno.land/std/path/mod.ts'
1
+ import { NextRequest } from 'https://esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/request.js'
2
+ import { NextResponse } from 'https://esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/response.js'
3
+ import { fromFileUrl } from 'https://deno.land/std@0.151.0/path/mod.ts'
3
4
  import { buildResponse } from './utils.ts'
4
5
 
5
6
  globalThis.NFRequestContextMap ||= new Map()
@@ -18,6 +19,7 @@ const exists = async (relativePath) => {
18
19
  throw error
19
20
  }
20
21
  }
22
+ let idx = 0
21
23
 
22
24
  const handler = async (req, context) => {
23
25
  // Uncomment when CLI update lands
@@ -33,8 +35,9 @@ const handler = async (req, context) => {
33
35
  // because that would also throw if there's an error in the middleware,
34
36
  // which we would want to surface not ignore.
35
37
  if (await exists('../../middleware.js')) {
36
- // These will be user code
37
- const nextMiddleware = await import('../../middleware.js')
38
+ // We need to cache-bust the import because otherwise it will claim it
39
+ // doesn't exist if the user creates it after the server starts
40
+ const nextMiddleware = await import(`../../middleware.js#${idx++}`)
38
41
  middleware = nextMiddleware.middleware
39
42
  } else {
40
43
  // No middleware, so we silently return