@netlify/plugin-nextjs 4.17.1-runtime.3 → 4.17.1-runtime.6
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/lib/helpers/dev.js +5 -11
- package/package.json +2 -2
- package/src/templates/edge/next-dev.js +4 -2
package/lib/helpers/dev.js
CHANGED
|
@@ -27,17 +27,11 @@ const onPreDev = async ({ constants, netlifyConfig }) => {
|
|
|
27
27
|
console.log('Watching for changes in Next.js middleware...');
|
|
28
28
|
}
|
|
29
29
|
// Eventually we might want to do this via esbuild's API, but for now the CLI works fine
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// Watch for both, because it can have either ts or js
|
|
36
|
-
(0, path_1.resolve)(base, 'middleware.ts'),
|
|
37
|
-
(0, path_1.resolve)(base, 'middleware.js'),
|
|
38
|
-
]);
|
|
39
|
-
childProcess.stdout.pipe(process.stdout);
|
|
40
|
-
childProcess.stderr.pipe(process.stderr);
|
|
30
|
+
const common = [`--bundle`, `--outdir=${(0, path_1.resolve)('.netlify')}`, `--format=esm`, `--target=esnext`, '--watch'];
|
|
31
|
+
// TypeScript
|
|
32
|
+
(0, execa_1.default)(`esbuild`, [...common, (0, path_1.resolve)(base, 'middleware.ts')], { all: true }).all.pipe(process.stdout);
|
|
33
|
+
// JavaScript
|
|
34
|
+
(0, execa_1.default)(`esbuild`, [...common, (0, path_1.resolve)(base, 'middleware.js')], { all: true }).all.pipe(process.stdout);
|
|
41
35
|
// Don't return the promise because we don't want to wait for the child process to finish
|
|
42
36
|
};
|
|
43
37
|
exports.onPreDev = onPreDev;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/plugin-nextjs",
|
|
3
|
-
"version": "4.17.1-runtime.
|
|
3
|
+
"version": "4.17.1-runtime.6",
|
|
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.
|
|
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
|
-
//
|
|
38
|
-
|
|
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
|