Skip to content

Commit

Permalink
chore(mod): upgrade modules
Browse files Browse the repository at this point in the history
  • Loading branch information
xlsdg committed Aug 8, 2017
1 parent 87f940d commit 445d979
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 46 deletions.
7 changes: 4 additions & 3 deletions .roadhogrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export default {
hash: true,
entry: 'src/index.js',
multipage: true,
publicPath: '/',
disableCSSModules: false,
autoprefixer: {
browsers: [
Expand All @@ -10,7 +9,6 @@ export default {
'iOS >= 6'
]
},
proxy: null,
extraBabelPlugins: [
'transform-runtime',
['import', {
Expand All @@ -20,9 +18,12 @@ export default {
],
env: {
production: {
multipage: true,
publicPath: '/dva-antd-starter/'
},
development: {
multipage: false,
publicPath: '/',
extraBabelPlugins: [
'dva-hmr'
]
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"start": "roadhog server"
},
"dependencies": {
"antd": "^2.12.4",
"antd": "^2.12.5",
"axios": "^0.16.2",
"babel-polyfill": "^6.23.0",
"dva": "^1.2.1",
Expand All @@ -27,15 +27,15 @@
"babel-plugin-transform-runtime": "^6.23.0",
"babel-runtime": "^6.25.0",
"ejs-loader": "^0.3.0",
"eslint": "^4.4.0",
"eslint": "^4.4.1",
"eslint-config-airbnb": "^15.1.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.1.0",
"expect": "^1.20.2",
"html-webpack-plugin": "^2.30.1",
"redbox-react": "^1.5.0",
"roadhog": "^0.6.0",
"roadhog": "^1.0.2",
"webpack-chunk-hash": "^0.4.0"
},
"engines": {
Expand Down
40 changes: 0 additions & 40 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,14 @@
const Webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const WebpackChunkHash = require('webpack-chunk-hash');
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;

module.exports = function(config, env) {
config.module.loaders[0].exclude.push(/\.ejs$/); // 注 1
if (env === 'production') {
config.entry = {
index: './src/index.js',
common: ['react', 'react-dom']
};
config.output.filename = '[name].[chunkhash].js';
config.output.chunkFilename = '[chunkhash].async.js';
config.plugins[3] = new ExtractTextPlugin('[contenthash:20].css'); // 注 2
for (let plugin, i = 0, l = config.plugins.length; i < l; i++) {
plugin = config.plugins[i];
if (plugin instanceof Webpack.optimize.CommonsChunkPlugin) {
config.plugins[i] = new Webpack.optimize.CommonsChunkPlugin({
name: 'common',
filename: 'common.[chunkhash].js',
minChunks: 2
});
break;
}
}
config.plugins.push(new Webpack.IgnorePlugin(/^\.\/locale$/, /moment$/));
// config.plugins.push(new BundleAnalyzerPlugin());
config.plugins.push(
new HtmlWebpackPlugin({
template: 'ejs!src/index.ejs', // 注 3
inject: true,
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: false
},
production: true,
}),
new WebpackChunkHash({
algorithm: 'md5'
})
);
} else {
config.plugins.push(
new HtmlWebpackPlugin({
template: 'ejs!src/index.ejs',
inject: true,
})
);
}
return config;
};

0 comments on commit 445d979

Please sign in to comment.