diff --git a/.eslintrc.cjs b/.eslintrc.cjs index aacbe3e..f7f5d6d 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,5 +1,9 @@ process.env.ESLINT_TSCONFIG = 'tsconfig.json' -const jsonExtJsoncFiles = ['**/tsconfig.*.json', '.vscode/*.json'] +const jsonExtJsoncFiles = [ + '**/tsconfig.json', + '**/tsconfig.*.json', + '.vscode/*.json', +] module.exports = { root: true, diff --git a/docs/.babelrc.js b/docs/.babelrc.js index 787c8d7..5bf6f51 100644 --- a/docs/.babelrc.js +++ b/docs/.babelrc.js @@ -1,4 +1,4 @@ -// https://nextjs.org/docs/advanced-features/customizing-babel-config +// https://nextjs.org/docs/pages/building-your-application/configuring/babel module.exports = { presets: [ 'next/babel', diff --git a/docs/pages/docs/compiler-plugin.mdx b/docs/pages/docs/compiler-plugin.mdx index ed32a05..232ffb6 100644 --- a/docs/pages/docs/compiler-plugin.mdx +++ b/docs/pages/docs/compiler-plugin.mdx @@ -171,7 +171,7 @@ Follow the docs of [Nextjs Babel configuration](https://nextjs.org/docs/pages/bu add plugin to `.babelrc.js` or `babel.config.js`: ```tsx filename=".babelrc.js" showLineNumbers {8} -// https://nextjs.org/docs/advanced-features/customizing-babel-config +// https://nextjs.org/docs/pages/building-your-application/configuring/babel module.exports = { presets: [ 'next/babel', diff --git a/docs/pages/docs/integration/nextjs.mdx b/docs/pages/docs/integration/nextjs.mdx index 7f196c1..2cf9109 100644 --- a/docs/pages/docs/integration/nextjs.mdx +++ b/docs/pages/docs/integration/nextjs.mdx @@ -32,7 +32,7 @@ Here provide a example template for your to create a `server.mjs` as custom serv ```js filename="server.mjs" showLineNumbers {6,27} /** - * https://nextjs.org/docs/advanced-features/custom-server + * https://nextjs.org/docs/pages/building-your-application/configuring/custom-server */ import { createServer } from 'node:http' import next from 'next' @@ -80,12 +80,11 @@ app.prepare().then(() => { } }) .once('error', (err) => { - console.error(err) - process.exit(1) - }) + console.error(err) + process.exit(1) + }) .listen(port, () => { - console.debug(`\n > Ready on http://${hostname}:${port} \n`) - }) + console.debug(`\n > Ready on http://${hostname}:${port} \n`) }) ``` diff --git a/docs/server.mjs b/docs/server.mjs index b03749a..304b5f9 100644 --- a/docs/server.mjs +++ b/docs/server.mjs @@ -1,5 +1,5 @@ /** - * https://nextjs.org/docs/advanced-features/custom-server + * https://nextjs.org/docs/pages/building-your-application/configuring/custom-server */ import { createServer } from 'node:http' import next from 'next' @@ -49,8 +49,12 @@ app.prepare().then(() => { res.statusCode = 500 res.end('internal server error') } - }).listen(port, (err) => { - if (err) throw err - console.debug(`\n > Ready on http://${hostname}:${port} \n`) }) + .once('error', (err) => { + console.error(err) + process.exit(1) + }) + .listen(port, () => { + console.debug(`\n > Ready on http://${hostname}:${port} \n`) + }) }) diff --git a/examples/nextjs-custom-server/.babelrc.js b/examples/nextjs-custom-server/.babelrc.js index 787c8d7..5bf6f51 100644 --- a/examples/nextjs-custom-server/.babelrc.js +++ b/examples/nextjs-custom-server/.babelrc.js @@ -1,4 +1,4 @@ -// https://nextjs.org/docs/advanced-features/customizing-babel-config +// https://nextjs.org/docs/pages/building-your-application/configuring/babel module.exports = { presets: [ 'next/babel', diff --git a/examples/nextjs-custom-server/server.mjs b/examples/nextjs-custom-server/server.mjs index b03749a..304b5f9 100644 --- a/examples/nextjs-custom-server/server.mjs +++ b/examples/nextjs-custom-server/server.mjs @@ -1,5 +1,5 @@ /** - * https://nextjs.org/docs/advanced-features/custom-server + * https://nextjs.org/docs/pages/building-your-application/configuring/custom-server */ import { createServer } from 'node:http' import next from 'next' @@ -49,8 +49,12 @@ app.prepare().then(() => { res.statusCode = 500 res.end('internal server error') } - }).listen(port, (err) => { - if (err) throw err - console.debug(`\n > Ready on http://${hostname}:${port} \n`) }) + .once('error', (err) => { + console.error(err) + process.exit(1) + }) + .listen(port, () => { + console.debug(`\n > Ready on http://${hostname}:${port} \n`) + }) })