From 6bd6549c40b1e8203dcdd1f62ce667d46f1a853e Mon Sep 17 00:00:00 2001 From: Ivan Date: Tue, 10 Apr 2018 16:00:43 +0300 Subject: [PATCH] #fix starting server code after compile assets (sync) --- packages/razzle/scripts/start.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/razzle/scripts/start.js b/packages/razzle/scripts/start.js index 556f24d16..59b77d767 100755 --- a/packages/razzle/scripts/start.js +++ b/packages/razzle/scripts/start.js @@ -63,18 +63,19 @@ function main() { // Compile our assets with webpack const clientCompiler = compile(clientConfig); - const serverCompiler = compile(serverConfig); - // Start our server webpack instance in watch mode. - serverCompiler.watch( - { - quiet: true, - stats: 'none', - }, - /* eslint-disable no-unused-vars */ - stats => {} - ); + // Start our server webpack instance in watch mode after assets compile + clientCompiler.plugin('done', () => { + serverCompiler.watch( + { + quiet: true, + stats: 'none', + }, + /* eslint-disable no-unused-vars */ + stats => {} + ); + }); // Create a new instance of Webpack-dev-server for our client assets. // This will actually run on a different port than the users app.