Skip to content

refactor: avoid unnecessary arguments to methods #3616

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

Merged
merged 1 commit into from
Aug 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,15 @@ class Server {
}

// eslint-disable-next-line class-methods-use-this
async normalizeOptions(options) {
async normalizeOptions() {
const { options } = this;

if (!this.logger) {
this.logger = this.compiler.getInfrastructureLogger("webpack-dev-server");
}

// TODO: improve this to not use .find for compiler watchOptions
const configArray = this.getCompilerConfigArray(this.compiler);
const configArray = this.getCompilerConfigArray();
const watchOptionsConfig = configArray.find(
(config) => config.watch !== false && config.watchOptions
);
Expand Down Expand Up @@ -1438,7 +1440,7 @@ class Server {
getStats(statsObj) {
const stats = Server.DEFAULT_STATS;

const configArray = this.getCompilerConfigArray(this.compiler);
const configArray = this.getCompilerConfigArray();
const statsOption = this.getStatsOption(configArray);

if (typeof statsOption === "object" && statsOption.warningsFilter) {
Expand Down Expand Up @@ -1669,7 +1671,7 @@ class Server {
}

async start() {
await this.normalizeOptions(this.options);
await this.normalizeOptions();

if (this.options.ipc) {
await new Promise((resolve, reject) => {
Expand Down