Skip to content

Commit e032ef8

Browse files
refactor: code
1 parent cc081a2 commit e032ef8

File tree

4 files changed

+170
-188
lines changed

4 files changed

+170
-188
lines changed

packages/webpack-cli/lib/bootstrap.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ const logger = require('./utils/logger');
77
const { isCommandUsed } = require('./utils/arg-utils');
88
const cliExecuter = require('./utils/cli-executer');
99
const argParser = require('./utils/arg-parser');
10+
1011
require('./utils/process-log');
12+
1113
process.title = 'webpack-cli';
1214

1315
// Create a new instance of the CLI object

packages/webpack-cli/lib/utils/Compiler.js

Lines changed: 0 additions & 167 deletions
This file was deleted.

packages/webpack-cli/lib/utils/interactive.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const { gray, bold, white, cyan, yellow } = require('colorette');
2-
const webpack = require('./Compiler');
32
const ansiEscapes = require('ansi-escapes');
43
const readline = require('readline');
54

@@ -96,19 +95,16 @@ const ENTER_KEY = '\n';
9695
const B_KEY = 'b';
9796
const C_KEY = 'c';
9897

99-
module.exports = async function (config, outputOptions) {
98+
module.exports = async function (compiler, config, outputOptions) {
10099
const stdin = process.stdin;
101100
stdin.setEncoding('utf-8');
102101
stdin.setRawMode(true);
103102
readline.emitKeypressEvents(stdin);
104103

105104
outputOptions.interactive = false;
106105

107-
const webpackCompilation = await webpack({ options: config, outputOptions });
108-
/* if(errors) {
109-
Hngggg
110-
} */
111-
state.push(webpackCompilation);
106+
state.push(compiler);
107+
112108
setupInteractive();
113109

114110
const isExitCtrl = (key) => key.ctrl && key.name === 'c';
@@ -164,8 +160,7 @@ module.exports = async function (config, outputOptions) {
164160
if (state.length) {
165161
state.pop();
166162
}
167-
const webpackCompilation = await webpack({ options: config, outputOptions });
168-
state.push(webpackCompilation);
163+
state.push(compiler);
169164
informActions();
170165
isSub = true;
171166
return;

0 commit comments

Comments
 (0)