diff --git a/.changesets/10359.md b/.changesets/10359.md new file mode 100644 index 000000000000..aa683e346116 --- /dev/null +++ b/.changesets/10359.md @@ -0,0 +1,3 @@ +- fix(cli): only show webpack options for dev if `bundler = "webpack"` (#10359) by @jtoar + + A few flags for `yarn rw dev` don't apply to Vite but are shown nevertheless. One of them, `watchNodeModules`, is legacy at this point. It's only useful for testing out framework changes on a project using webpack. It makes the webpack dev server reload on changes to node_modules. The other, `forward` (aliased `fwd`) isn't fundamentally Webpack specific, but has been broken for quite a while because the fix is nontrivial. It seems better to hide these flags for now, otherwise we're just advertising broken or no-op behavior. diff --git a/packages/cli/src/commands/dev.js b/packages/cli/src/commands/dev.js index f9b726c7fa70..696c74e06b60 100644 --- a/packages/cli/src/commands/dev.js +++ b/packages/cli/src/commands/dev.js @@ -1,5 +1,6 @@ import terminalLink from 'terminal-link' +import { getConfig } from '../lib' import c from '../lib/colors' import { checkNodeVersion } from '../middleware/checkNodeVersion' @@ -7,6 +8,12 @@ export const command = 'dev [side..]' export const description = 'Start development servers for api, and web' export const builder = (yargs) => { + // We hide some options based on the bundler being used. + // Note that `watchNodeModules` is webpack specific, but `forward` isn't. + // The reason it's also hidden is that it's been broken with Vite + // and it's not clear how to fix it. + const isUsingWebpack = getConfig().web.bundler === 'webpack' + yargs .positional('side', { choices: ['api', 'web'], @@ -19,6 +26,7 @@ export const builder = (yargs) => { description: 'String of one or more Webpack DevServer config options, for example: `--fwd="--port=1234 --no-open"`', type: 'string', + hidden: !isUsingWebpack, }) .option('generate', { type: 'boolean', @@ -28,6 +36,7 @@ export const builder = (yargs) => { .option('watchNodeModules', { type: 'boolean', description: 'Reload on changes to node_modules', + hidden: !isUsingWebpack, }) .option('apiDebugPort', { type: 'number',