File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -5,9 +5,11 @@ import * as webpackMiddleware from 'webpack-dev-middleware';
55import * as webpackHotMiddleware from 'webpack-hot-middleware' ;
66import * as webpack from 'webpack' ;
77import * as webpackConfig from '../webpack.config.demo.dev' ;
8+ import * as opn from 'opn' ;
89const packageJson = require ( '../package.json' ) ;
910
1011const webpackCompiler = webpack ( webpackConfig as any ) ;
12+ const port = 4000 ;
1113
1214require . extensions [ '.html' ] = ( module , filename ) => {
1315 module . exports = fs . readFileSync ( filename , 'utf8' ) ;
@@ -19,6 +21,8 @@ app.use(webpackMiddleware(webpackCompiler));
1921app . use ( webpackHotMiddleware ( webpackCompiler ) ) ;
2022app . use ( ( req , res ) => res . status ( 200 ) . send ( require ( './index.html' ) ) ) ;
2123
22- app . listen ( 4000 , '0.0.0.0' , ( ) => {
23- console . log ( colors . green ( `${ packageJson . name } at http://localhost:4000/` ) ) ;
24+ app . listen ( port , '0.0.0.0' , ( ) => {
25+ const demoUrl = `http://localhost:${ port } /` ;
26+ console . log ( colors . green ( `${ packageJson . name } at ${ demoUrl } ` ) ) ;
27+ opn ( demoUrl ) ;
2428} ) ;
You can’t perform that action at this time.
0 commit comments