commit abc30e1d45cb7d03c203ebdb0aeea32e36e757e7
parent 57f68de1dad05423101eecb99d08555740374a07
Author: Vladimir Kutepov <frenzzy.man@gmail.com>
Date: Fri, 18 Nov 2016 18:29:23 +0400
Support multiple entry points out of the box (#963)
closes #811, #953
Diffstat:
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/server.js b/src/server.js
@@ -111,7 +111,7 @@ app.get('*', async (req, res, next) => {
const data = { ...route };
data.children = ReactDOM.renderToString(<App context={context}>{route.component}</App>);
data.style = [...css].join('');
- data.script = assets.main.js;
+ data.script = assets.client.js;
data.chunk = assets[route.chunk] && assets[route.chunk].js;
const html = ReactDOM.renderToStaticMarkup(<Html {...data} />);
diff --git a/tools/start.js b/tools/start.js
@@ -30,7 +30,8 @@ async function start() {
await new Promise(resolve => {
// Hot Module Replacement (HMR) + React Hot Reload
if (config.debug) {
- config.entry = ['react-hot-loader/patch', 'webpack-hot-middleware/client', config.entry];
+ config.entry.client = ['react-hot-loader/patch', 'webpack-hot-middleware/client']
+ .concat(config.entry.client);
config.output.filename = config.output.filename.replace('[chunkhash]', '[hash]');
config.output.chunkFilename = config.output.chunkFilename.replace('[chunkhash]', '[hash]');
config.module.loaders.find(x => x.loader === 'babel-loader')
diff --git a/tools/webpack.config.js b/tools/webpack.config.js
@@ -214,7 +214,9 @@ const config = {
// -----------------------------------------------------------------------------
const clientConfig = extend(true, {}, config, {
- entry: './client.js',
+ entry: {
+ client: './client.js',
+ },
output: {
filename: isDebug ? '[name].js?[chunkhash]' : '[name].[chunkhash].js',
@@ -272,7 +274,9 @@ const clientConfig = extend(true, {}, config, {
// -----------------------------------------------------------------------------
const serverConfig = extend(true, {}, config, {
- entry: './server.js',
+ entry: {
+ server: './server.js',
+ },
output: {
filename: '../../server.js',