From fd5f56e4bbfe215bba9efba1a7e520dda3b40782 Mon Sep 17 00:00:00 2001 From: alexlbr Date: Wed, 7 Jun 2017 17:42:36 +0100 Subject: [PATCH] finished hotreloading --- config/webpack.config.client.dev.js | 19 +++-- config/webpack.config.client.prod.js | 14 ++-- config/webpack.config.server.js | 16 ++++- config/webpackDevServer.config.js | 92 ++++++++++++++++++++++++ package.json | 7 +- scripts/{start-universal.js => start.js} | 38 +++++----- src/server/index.js | 6 +- src/shared/app.css | 3 - 8 files changed, 150 insertions(+), 45 deletions(-) create mode 100644 config/webpackDevServer.config.js rename scripts/{start-universal.js => start.js} (84%) delete mode 100644 src/shared/app.css diff --git a/config/webpack.config.client.dev.js b/config/webpack.config.client.dev.js index 5df0411..f47b8ad 100644 --- a/config/webpack.config.client.dev.js +++ b/config/webpack.config.client.dev.js @@ -9,7 +9,9 @@ const paths = require('./paths'); const base = require('./webpack.config.base'); -base.entry = [ +const config = Object.assign({}, base) + +config.entry = [ // Include an alternative client for WebpackDevServer. A client's job is to // connect to WebpackDevServer by a socket and get notified about changes. // When you save a file, the client will either apply hot updates (in case @@ -32,7 +34,7 @@ base.entry = [ // changing JS code would still trigger a refresh. ] -base.output = { +config.output = { // Next line is not used in dev but WebpackDevServer crashes without it: path: paths.appBuild, // Add /* filename */ comments to generated require()s in the output. @@ -45,12 +47,14 @@ base.output = { chunkFilename: 'static/js/[name].chunk.js', // This is the URL that app is served from. We use "/" in development. publicPath: '/', + hotUpdateChunkFilename: 'static/[id].[hash].hot-update.js', + hotUpdateMainFilename: 'static/[hash].hot-update.json', // Point sourcemap entries to original disk location devtoolModuleFilenameTemplate: info => path.resolve(info.absoluteResourcePath), } -base.module.rules = base.module.rules.concat([ +config.module.rules = config.module.rules.concat([ // "postcss" loader applies autoprefixer to our CSS. // "css" loader resolves paths in CSS and adds assets as dependencies. // "style" loader turns CSS into JS modules that inject