feat: code split & use react helmet

This commit is contained in:
endiliey 2018-08-23 21:46:14 +08:00
parent bf1e30dc52
commit 406106b67e
19 changed files with 241 additions and 146 deletions

20
lib/webpack/client.js Normal file
View file

@ -0,0 +1,20 @@
const path = require('path');
const webpackNiceLog = require('webpack-nicelog');
const {StatsWriterPlugin} = require('webpack-stats-plugin');
const createBaseConfig = require('./base');
module.exports = function createClientConfig(props) {
const config = createBaseConfig(props);
config.entry('main').add(path.resolve(__dirname, '../core/clientEntry.js'));
// write webpack stats object to a file so we can
// programmatically refer to the correct bundle path in Node.js server.
config
.plugin('stats')
.use(StatsWriterPlugin, [{filename: 'client.stats.json'}]);
config.plugin('niceLog').use(webpackNiceLog, [{name: 'Client'}]);
return config;
};