From 445d979bb77b4dd7f31575adff185cf41a38319b Mon Sep 17 00:00:00 2001 From: xLsDg Date: Tue, 8 Aug 2017 16:42:27 +0800 Subject: [PATCH] chore(mod): upgrade modules --- .roadhogrc.js | 7 ++++--- package.json | 6 +++--- webpack.config.js | 40 ---------------------------------------- 3 files changed, 7 insertions(+), 46 deletions(-) diff --git a/.roadhogrc.js b/.roadhogrc.js index 18b5f5a..7b19ff5 100644 --- a/.roadhogrc.js +++ b/.roadhogrc.js @@ -1,7 +1,6 @@ export default { + hash: true, entry: 'src/index.js', - multipage: true, - publicPath: '/', disableCSSModules: false, autoprefixer: { browsers: [ @@ -10,7 +9,6 @@ export default { 'iOS >= 6' ] }, - proxy: null, extraBabelPlugins: [ 'transform-runtime', ['import', { @@ -20,9 +18,12 @@ export default { ], env: { production: { + multipage: true, publicPath: '/dva-antd-starter/' }, development: { + multipage: false, + publicPath: '/', extraBabelPlugins: [ 'dva-hmr' ] diff --git a/package.json b/package.json index e8248f7..c2e7f08 100644 --- a/package.json +++ b/package.json @@ -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", @@ -27,7 +27,7 @@ "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", @@ -35,7 +35,7 @@ "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": { diff --git a/webpack.config.js b/webpack.config.js index d64906d..951c9b7 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -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; };