feat(nextjs): deprecate proxy config option for server executor (#15855)

This commit is contained in:
Jack Hsu 2023-03-23 11:14:17 -04:00 committed by GitHub
parent 7d61ae238b
commit e611a0bab7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View File

@ -51,7 +51,8 @@
"proxyConfig": { "proxyConfig": {
"type": "string", "type": "string",
"description": "Path to the proxy configuration file.", "description": "Path to the proxy configuration file.",
"x-completion-type": "file" "x-completion-type": "file",
"x-deprecated": "Use the built-in rewrite feature from Next.js. See: https://nextjs.org/docs/api-reference/next.config.js/rewrites"
}, },
"buildLibsFromSource": { "buildLibsFromSource": {
"type": "boolean", "type": "boolean",

View File

@ -48,7 +48,8 @@
"proxyConfig": { "proxyConfig": {
"type": "string", "type": "string",
"description": "Path to the proxy configuration file.", "description": "Path to the proxy configuration file.",
"x-completion-type": "file" "x-completion-type": "file",
"x-deprecated": "Use the built-in rewrite feature from Next.js. See: https://nextjs.org/docs/api-reference/next.config.js/rewrites"
}, },
"buildLibsFromSource": { "buildLibsFromSource": {
"type": "boolean", "type": "boolean",

View File

@ -20,8 +20,6 @@ import {
import { customServer } from './lib/custom-server'; import { customServer } from './lib/custom-server';
import { defaultServer } from './lib/default-server'; import { defaultServer } from './lib/default-server';
const infoPrefix = `[ ${chalk.dim(chalk.cyan('info'))} ] `;
export default async function* serveExecutor( export default async function* serveExecutor(
options: NextServeBuilderOptions, options: NextServeBuilderOptions,
context: ExecutorContext context: ExecutorContext
@ -79,9 +77,10 @@ async function* runNextDevServer(
? join(context.root, options.proxyConfig) ? join(context.root, options.proxyConfig)
: join(root, 'proxy.conf.json'); : join(root, 'proxy.conf.json');
// TODO(v16): Remove proxy support.
if (existsSync(proxyConfigPath)) { if (existsSync(proxyConfigPath)) {
logger.info( logger.warn(
`${infoPrefix} found proxy configuration at ${proxyConfigPath}` `The "proxyConfig" option will be removed in Nx 16. Use the "rewrites" feature from Next.js instead. See: https://nextjs.org/docs/api-reference/next.config.js/rewrites`
); );
proxyConfig = require(proxyConfigPath); proxyConfig = require(proxyConfigPath);
} }