Skip to content

Commit bc37bfb

Browse files
committed
➖ remove webpack-dashboard, it doesn't work properly and implementation is buggy
1 parent 115fd53 commit bc37bfb

File tree

8 files changed

+38
-78
lines changed

8 files changed

+38
-78
lines changed

Diff for: .env

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@ OPEN_BROWSER=false
22

33
REACT_APP_SASS=true
44
REACT_APP_LESS=true
5-
REACT_APP_CSS_MODULES=true
6-
7-
REACT_APP_WEBPACK_DASHBOARD=false
5+
REACT_APP_CSS_MODULES=true

Diff for: README.md

-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* LESS
1010
* SASS
1111
* CSS modules
12-
* webpack-dashboard
1312

1413
**the features are optional and can be turned on/off individually*
1514

@@ -27,9 +26,6 @@ The generated project comes with SASS, LESS, and CSS modules support by default,
2726
- ```REACT_APP_LESS=true``` - enable LESS support
2827
- ```REACT_APP_CSS_MODULES``` - enable CSS modules
2928

30-
#### Webpack
31-
- ```REACT_APP_WEBPACK_DASHBOARD=true``` - enable webpack-dashboard
32-
3329
#### Babel
3430
- ```REACT_APP_BABEL_STAGE_0=true``` - enable stage-0 Babel preset
3531
- ```REACT_APP_DECORATORS=true``` - enable decorators support

Diff for: packages/react-scripts/README.md

-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* LESS
1010
* SASS
1111
* CSS modules
12-
* webpack-dashboard
1312

1413
**the features are optional and can be turned on/off individually*
1514

@@ -27,9 +26,6 @@ The generated project comes with SASS, LESS, and CSS modules support by default,
2726
- ```REACT_APP_LESS=true``` - enable LESS support
2827
- ```REACT_APP_CSS_MODULES``` - enable CSS modules
2928

30-
#### Webpack
31-
- ```REACT_APP_WEBPACK_DASHBOARD=true``` - enable webpack-dashboard
32-
3329
#### Babel
3430
- ```REACT_APP_BABEL_STAGE_0=true``` - enable stage-0 Babel preset
3531
- ```REACT_APP_DECORATORS=true``` - enable decorators support

Diff for: packages/react-scripts/bin/CUSTOM_README.md

-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* LESS
1010
* SASS
1111
* CSS modules
12-
* webpack-dashboard
1312

1413
**the features are optional and can be turned on/off individually*
1514

@@ -27,9 +26,6 @@ The generated project comes with SASS, LESS, and CSS modules support by default,
2726
- ```REACT_APP_LESS=true``` - enable LESS support
2827
- ```REACT_APP_CSS_MODULES``` - enable CSS modules
2928

30-
#### Webpack
31-
- ```REACT_APP_WEBPACK_DASHBOARD=true``` - enable webpack-dashboard
32-
3329
#### Babel
3430
- ```REACT_APP_BABEL_STAGE_0=true``` - enable stage-0 Babel preset
3531
- ```REACT_APP_DECORATORS=true``` - enable decorators support

Diff for: packages/react-scripts/config/customizers.js

-9
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,6 @@ module.exports = {
2929
}
3030
}
3131
},
32-
'WEBPACK_DASHBOARD': {
33-
toArray: 'plugins',
34-
prod: false,
35-
get: function () {
36-
var DashboardPlugin = require('webpack-dashboard/plugin');
37-
var Dashboard = require('webpack-dashboard');
38-
return new DashboardPlugin(new Dashboard().setData)
39-
}
40-
},
4132
'CSS_MODULES': {
4233
config: {
4334
dev: 'style!css?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss',

Diff for: packages/react-scripts/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
"style-loader": "0.13.1",
7171
"url-loader": "0.5.7",
7272
"webpack": "1.13.2",
73-
"webpack-dashboard": "^0.1.8",
7473
"webpack-dev-server": "1.16.1",
7574
"whatwg-fetch": "1.0.0"
7675
},

Diff for: packages/react-scripts/scripts/start.js

+37-45
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,12 @@ var openBrowser = require('react-dev-utils/openBrowser');
3030
var prompt = require('react-dev-utils/prompt');
3131
var config = require('../config/webpack.config.dev');
3232
var paths = require('../config/paths');
33-
var getCustomConfig = require('../config/get-custom-config');
34-
var customConfig = getCustomConfig(false);
3533

3634
// Warn and crash if required files are missing
3735
if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
3836
process.exit(1);
3937
}
4038

41-
function log() {
42-
if (customConfig.values.WEBPACK_DASHBOARD === true) {
43-
return;
44-
}
45-
console.log.apply(null, arguments);
46-
};
47-
4839
// Tools like Cloud9 rely on this.
4940
var DEFAULT_PORT = process.env.PORT || 3000;
5041
var compiler;
@@ -72,73 +63,73 @@ function setupCompiler(host, port, protocol) {
7263
// recompiling a bundle. WebpackDevServer takes care to pause serving the
7364
// bundle, so if you refresh, it'll wait instead of serving the old one.
7465
// "invalid" is short for "bundle invalidated", it doesn't imply any errors.
75-
compiler.plugin('invalid', function () {
66+
compiler.plugin('invalid', function() {
7667
clearConsole();
77-
log('Compiling...');
68+
console.log('Compiling...');
7869
});
7970

8071
// "done" event fires when Webpack has finished recompiling the bundle.
8172
// Whether or not you have warnings or errors, you will get this event.
82-
compiler.plugin('done', function (stats) {
73+
compiler.plugin('done', function(stats) {
8374
clearConsole();
8475

8576
// We have switched off the default Webpack output in WebpackDevServer
8677
// options so we are going to "massage" the warnings and errors and present
8778
// them in a readable focused way.
8879
var messages = formatWebpackMessages(stats.toJson({}, true));
8980
if (!messages.errors.length && !messages.warnings.length) {
90-
log(chalk.green('Compiled successfully!'));
91-
log();
92-
log('The app is running at:');
93-
log();
94-
log(' ' + chalk.cyan(protocol + '://' + host + ':' + port + '/'));
95-
log();
96-
log('Note that the development build is not optimized.');
97-
log('To create a production build, use ' + chalk.cyan('npm run build') + '.');
98-
log();
81+
console.log(chalk.green('Compiled successfully!'));
82+
console.log();
83+
console.log('The app is running at:');
84+
console.log();
85+
console.log(' ' + chalk.cyan(protocol + '://' + host + ':' + port + '/'));
86+
console.log();
87+
console.log('Note that the development build is not optimized.');
88+
console.log('To create a production build, use ' + chalk.cyan('npm run build') + '.');
89+
console.log();
9990
}
10091

10192
// If errors exist, only show errors.
10293
if (messages.errors.length) {
103-
log(chalk.red('Failed to compile.'));
104-
log();
94+
console.log(chalk.red('Failed to compile.'));
95+
console.log();
10596
messages.errors.forEach(message => {
106-
log(message);
107-
log();
97+
console.log(message);
98+
console.log();
10899
});
109100
return;
110101
}
111102

112103
// Show warnings if no errors were found.
113104
if (messages.warnings.length) {
114-
log(chalk.yellow('Compiled with warnings.'));
115-
log();
105+
console.log(chalk.yellow('Compiled with warnings.'));
106+
console.log();
116107
messages.warnings.forEach(message => {
117-
log(message);
118-
log();
108+
console.log(message);
109+
console.log();
119110
});
120111
// Teach some ESLint tricks.
121-
log('You may use special comments to disable some warnings.');
122-
log('Use ' + chalk.yellow('// eslint-disable-next-line') + ' to ignore the next line.');
123-
log('Use ' + chalk.yellow('/* eslint-disable */') + ' to ignore all warnings in a file.');
112+
console.log('You may use special comments to disable some warnings.');
113+
console.log('Use ' + chalk.yellow('// eslint-disable-next-line') + ' to ignore the next line.');
114+
console.log('Use ' + chalk.yellow('/* eslint-disable */') + ' to ignore all warnings in a file.');
124115
}
125116
});
126117
}
127118

128119
// We need to provide a custom onError function for httpProxyMiddleware.
129120
// It allows us to log custom error messages on the console.
130121
function onProxyError(proxy) {
131-
return function (err, req, res) {
122+
return function(err, req, res){
132123
var host = req.headers && req.headers.host;
133-
log(
124+
console.log(
134125
chalk.red('Proxy error:') + ' Could not proxy request ' + chalk.cyan(req.url) +
135126
' from ' + chalk.cyan(host) + ' to ' + chalk.cyan(proxy) + '.'
136127
);
137-
log(
128+
console.log(
138129
'See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (' +
139130
chalk.cyan(err.code) + ').'
140131
);
141-
log();
132+
console.log();
142133

143134
// And immediately send the proper error response to the client.
144135
// Otherwise, the request will eventually timeout with ERR_EMPTY_RESPONSE on the client side.
@@ -172,9 +163,9 @@ function addMiddleware(devServer) {
172163
}));
173164
if (proxy) {
174165
if (typeof proxy !== 'string') {
175-
log(chalk.red('When specified, "proxy" in package.json must be a string.'));
176-
log(chalk.red('Instead, the type of "proxy" was "' + typeof proxy + '".'));
177-
log(chalk.red('Either remove "proxy" from package.json, or make it a string.'));
166+
console.log(chalk.red('When specified, "proxy" in package.json must be a string.'));
167+
console.log(chalk.red('Instead, the type of "proxy" was "' + typeof proxy + '".'));
168+
console.log(chalk.red('Either remove "proxy" from package.json, or make it a string.'));
178169
process.exit(1);
179170
}
180171

@@ -183,7 +174,7 @@ function addMiddleware(devServer) {
183174
// - /index.html (served as HTML5 history API fallback)
184175
// - /*.hot-update.json (WebpackDevServer uses this too for hot reloading)
185176
// - /sockjs-node/* (WebpackDevServer uses this for hot reloading)
186-
// Tip: use https://www.debuggex.com/ to visualize the regex
177+
// Tip: use https://jex.im/regulex/ to visualize the regex
187178
var mayProxy = /^(?!\/(index\.html$|.*\.hot-update\.json$|sockjs-node\/)).*$/;
188179
devServer.use(mayProxy,
189180
// Pass the scope regex both to Express and to the middleware for proxying
@@ -250,12 +241,12 @@ function runDevServer(host, port, protocol) {
250241
// Launch WebpackDevServer.
251242
devServer.listen(port, (err, result) => {
252243
if (err) {
253-
return log(err);
244+
return console.log(err);
254245
}
255246

256-
log(chalk.cyan('Starting the development server...'));
257-
log();
258-
247+
clearConsole();
248+
console.log(chalk.cyan('Starting the development server...'));
249+
console.log();
259250
if (process.env && process.env.OPEN_BROWSER !== 'false') {
260251
openBrowser(protocol + '://' + host + ':' + port + '/');
261252
}
@@ -272,11 +263,12 @@ function run(port) {
272263
// We attempt to use the default port but if it is busy, we offer the user to
273264
// run on a different port. `detect()` Promise resolves to the next free port.
274265
detect(DEFAULT_PORT).then(port => {
275-
if (port === DEFAULT_PORT || customConfig.values.WEBPACK_DASHBOARD === true) {
266+
if (port === DEFAULT_PORT) {
276267
run(port);
277268
return;
278269
}
279270

271+
clearConsole();
280272
var question =
281273
chalk.yellow('Something is already running on port ' + DEFAULT_PORT + '.') +
282274
'\n\nWould you like to run the app on another port instead?';

Diff for: packages/react-scripts/template/src/App.js

-8
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,6 @@ class App extends Component {
6363
</li>
6464
</ul>
6565

66-
<b> Webpack </b>
67-
<ul className="configs babel-configs">
68-
<li>
69-
<code>REACT_APP_WEBPACK_DASHBOARD=true</code>
70-
<span>- Enable webpack-dashboard ⚠️ <span className={styles.experimental}>(experimental)</span> </span>
71-
</li>
72-
</ul>
73-
7466
<b> Others </b>
7567
<ul className="configs style-configs">
7668
<li>

0 commit comments

Comments
 (0)