File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -28,3 +28,6 @@ node_modules
28
28
29
29
# Bower
30
30
bower_components /
31
+
32
+ # IDE/Editor data
33
+ .idea
Original file line number Diff line number Diff line change @@ -6,12 +6,31 @@ const WebpackDevServer = require('webpack-dev-server');
6
6
const config = require ( './webpack.config' ) ;
7
7
const open = require ( 'open' ) ;
8
8
9
- new WebpackDevServer ( webpack ( config ) , config . devServer )
9
+ /**
10
+ * Flag indicating whether webpack compiled for the first time.
11
+ * @type {boolean }
12
+ */
13
+ let isInitialCompilation = true ;
14
+
15
+ const compiler = webpack ( config ) ;
16
+
17
+ new WebpackDevServer ( compiler , config . devServer )
10
18
. listen ( config . port , 'localhost' , ( err ) => {
11
19
if ( err ) {
12
20
console . log ( err ) ;
13
21
}
14
22
console . log ( 'Listening at localhost:' + config . port ) ;
15
- console . log ( 'Opening your system browser...' ) ;
16
- open ( 'http://localhost:' + config . port + '/webpack-dev-server/' ) ;
23
+ } ) ;
24
+
25
+ compiler . plugin ( 'done' , ( ) => {
26
+ if ( isInitialCompilation ) {
27
+ // Ensures that we log after webpack printed its stats (is there a better way?)
28
+ setTimeout ( ( ) => {
29
+ console . log ( '\n✓ The bundle is now ready for serving!\n' ) ;
30
+ console . log ( ' Open in iframe Mode:\t\x1b[33m%s\x1b[0m' , 'http://localhost:' + config . port + '/webpack-dev-server/' ) ;
31
+ console . log ( ' Open in inline Mode:\t\x1b[33m%s\x1b[0m' , 'http://localhost:' + config . port + '/\n' ) ;
32
+ console . log ( ' \x1b[33mHRM is active\x1b[0m. The bundle will automatically rebuild and live-update on changes.' )
33
+ } , 350 ) ;
34
+ }
35
+ isInitialCompilation = false ;
17
36
} ) ;
You can’t perform that action at this time.
0 commit comments