-
-
Notifications
You must be signed in to change notification settings - Fork 856
Additional follow-up fix for #1704 to remove remaining warnings #1736
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
Changes from 7 commits
2a362ae
de1903e
2cd8075
e03de48
722186a
a859278
9754732
8c90455
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| 'use strict'; | ||
|
|
||
| const devserverPkg = require('webpack-dev-server/package.json'); | ||
|
|
||
| module.exports = devserverPkg.version ? parseInt(devserverPkg.version[0]) : 3; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ const logger = require('razzle-dev-utils/logger'); | |
| const setPorts = require('razzle-dev-utils/setPorts'); | ||
| const chalk = require('chalk'); | ||
| const terminate = require('terminate'); | ||
| const devServerMajorVersion = require('razzle-dev-utils/devServerMajor'); | ||
|
|
||
| let verbose = false; | ||
|
|
||
|
|
@@ -172,20 +173,30 @@ function main() { | |
| // This will actually run on a different port than the users app. | ||
| clientDevServer = new devServer( | ||
| clientCompiler, | ||
| Object.assign(clientConfig.devServer, { verbose: verbose }) | ||
| Object.assign(clientConfig.devServer, { verbose, port }), | ||
| ); | ||
| // Start Webpack-dev-server | ||
| clientDevServer.listen(port, err => { | ||
| if (err) { | ||
| logger.error(err); | ||
| } | ||
| }); | ||
| if (devServerMajorVersion > 3) { | ||
| // listen was deprecated in v4 and causes issues when used, switch to its replacement | ||
| clientDevServer.start(); | ||
|
||
| } else { | ||
| // Start Webpack-dev-server | ||
| clientDevServer.listen(port, err => { | ||
| if (err) { | ||
| logger.error(err); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| ['SIGINT', 'SIGTERM'].forEach(sig => { | ||
| process.on(sig, () => { | ||
| if (clientDevServer) { | ||
| clientDevServer.close(); | ||
| if (devServerMajorVersion > 3) { | ||
| // close was deprecated in v4, switch to its replacement | ||
| clientDevServer.stop(); | ||
| } else { | ||
| clientDevServer.close(); | ||
| } | ||
| } | ||
| if (watching) { | ||
| watching.close(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍