Skip to content

Commit

Permalink
only show webpack options if bundler = webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
jtoar committed Mar 28, 2024
1 parent d6243c2 commit c24d5e6
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions packages/cli/src/commands/dev.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import terminalLink from 'terminal-link'

import { getConfig } from '../lib'
import c from '../lib/colors'
import { checkNodeVersion } from '../middleware/checkNodeVersion'

Expand All @@ -14,21 +15,11 @@ export const builder = (yargs) => {
description: 'Which dev server(s) to start',
type: 'array',
})
.option('forward', {
alias: 'fwd',
description:
'String of one or more Webpack DevServer config options, for example: `--fwd="--port=1234 --no-open"`',
type: 'string',
})
.option('generate', {
type: 'boolean',
default: true,
description: 'Generate artifacts',
})
.option('watchNodeModules', {
type: 'boolean',
description: 'Reload on changes to node_modules',
})
.option('apiDebugPort', {
type: 'number',
description:
Expand All @@ -49,6 +40,22 @@ export const builder = (yargs) => {
'https://redwoodjs.com/docs/cli-commands#dev',
)}`,
)

// Note that `watchNodeModules` is webpack specific, but `forward` isn't.
// The reason it's here is that it's been broken with Vite and it's not clear how to fix it.
if (getConfig().web.bundler === 'webpack') {
yargs
.option('forward', {
alias: 'fwd',
description:
'String of one or more Webpack DevServer config options, for example: `--fwd="--port=1234 --no-open"`',
type: 'string',
})
.option('watchNodeModules', {
type: 'boolean',
description: 'Reload on changes to node_modules',
})
}
}

export const handler = async (options) => {
Expand Down

0 comments on commit c24d5e6

Please sign in to comment.