@netlify/plugin-nextjs 4.17.1-runtime.3 → 4.17.1-runtime.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/plugin-nextjs",
3
- "version": "4.17.1-runtime.3",
3
+ "version": "4.17.1-runtime.4",
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",
@@ -19,6 +19,7 @@ const exists = async (relativePath) => {
19
19
  throw error
20
20
  }
21
21
  }
22
+ let idx = 0
22
23
 
23
24
  const handler = async (req, context) => {
24
25
  // Uncomment when CLI update lands
@@ -34,8 +35,9 @@ const handler = async (req, context) => {
34
35
  // because that would also throw if there's an error in the middleware,
35
36
  // which we would want to surface not ignore.
36
37
  if (await exists('../../middleware.js')) {
37
- // These will be user code
38
- 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++}`)
39
41
  middleware = nextMiddleware.middleware
40
42
  } else {
41
43
  // No middleware, so we silently return