Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING CHANGE: remove CLI default flag values for webpack-cli serve #2659

Merged
merged 11 commits into from
Aug 22, 2020
8 changes: 6 additions & 2 deletions bin/cli-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ module.exports = {
{
name: 'live-reload',
type: Boolean,
defaultValue: true,
describe: 'Enables/Disables live reloading on changing files',
},
{
Expand Down Expand Up @@ -57,12 +56,12 @@ module.exports = {
name: 'open-page',
type: String,
describe: 'Open default browser with the specified page',
multiple: true,
},
{
name: 'client-logging',
type: String,
group: DISPLAY_GROUP,
defaultValue: 'info',
describe:
'Log level in the browser (none, error, warn, info, log, verbose)',
},
Expand Down Expand Up @@ -132,5 +131,10 @@ module.exports = {
group: CONNECTION_GROUP,
multiple: true,
},
{
name: 'name',
type: String,
describe: 'Name of webpack config to get devServer config from',
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we have it here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we have it here?

@evilebottnawi We need it for this: webpack/webpack-cli#1649 (comment). Unless we want to add this flag on the webpack-cli side, but I think it is easiest to keep it uniform with other CLI flags

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is already added on webpack-cli side

Copy link
Collaborator Author

@knagaitsev knagaitsev Aug 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is already added on webpack-cli side

Do you know where to find it on webpack-cli side? I can't seem to find it

Edit: never mind, I think I found the PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes 👍

],
};
2 changes: 0 additions & 2 deletions bin/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const options = {
'live-reload': {
type: 'boolean',
describe: 'Enables/Disables live reloading on changing files',
default: true,
},
profile: {
type: 'boolean',
Expand Down Expand Up @@ -56,7 +55,6 @@ const options = {
'client-logging': {
type: 'string',
group: DISPLAY_GROUP,
default: 'info',
describe:
'Log level in the browser (none, error, warn, info, log, verbose)',
},
Expand Down
2 changes: 2 additions & 0 deletions client-src/default/utils/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
const log = require('webpack/lib/logging/runtime');

const name = 'webpack-dev-server';
// default level is set on the client side, so it does not need
// to be set by the CLI or API
const defaultLevel = 'info';

function setLogLevel(level) {
Expand Down
8 changes: 7 additions & 1 deletion lib/utils/createConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ function createConfig(config, argv, { port }) {
options.bonjour = true;
}

if (argv.host && (argv.host !== 'localhost' || !options.host)) {
// CLI args host takes precedence over devServer host
if (argv.host) {
options.host = argv.host;
}

// host defaults to localhost for CLI if none is provided
if (!options.host) {
options.host = 'localhost';
}

if (argv.allowedHosts) {
options.allowedHosts = argv.allowedHosts.split(',');
}
Expand Down
Loading