| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 | 
							- const webpack = require('webpack');
 
- const path = require('path');
 
- const ExtractTextPlugin = require("extract-text-webpack-plugin");
 
- const HtmlWebpackPlugin = require('html-webpack-plugin');
 
- const WebpackDevServer = require('webpack-dev-server');
 
- const entries = require('./webpack/entry.config.js');
 
- const version = require('./package.json').version;
 
- const argv = require('yargs').argv;
 
- const ImageminPlugin = require('imagemin-webpack-plugin').default;
 
- let theme = {
 
-     '@primary-color': '#58a3ff',
 
-     '@link-color': '#58a3ff'
 
- };
 
- let isWatch = argv.env.watch == 'watch';
 
- let isDev = isWatch || argv.env.deploy == 'dev';
 
- module.exports = (function () {
 
-     let plugins =[
 
-         //把入口文件里面的数组打包成verdors.js
 
-         // new ImageminPlugin({
 
-         //     disable: isDev,
 
-         //     test: 'img/**',
 
-         //     pngquant: {
 
-         //         quality: '75-75', 
 
-         //         optimizationLevel: 9
 
-         //     }
 
-         // }),
 
-         new webpack.optimize.CommonsChunkPlugin({
 
-             name: 'vendors'
 
-         }),
 
-         new ExtractTextPlugin({
 
-             filename: "[name].css",
 
-             disable: false,
 
-             allChunks: true
 
-         }),
 
-         new webpack.ProvidePlugin({
 
-             $: "jquery",
 
-             jQuery: "jquery"
 
-         }),       
 
-         new HtmlWebpackPlugin({
 
-             title: '首页',
 
-             filename: 'html/index.html',
 
-             template: './template/index.html',
 
-             chunks: ['index', 'vendors']
 
-         }), 
 
-         new HtmlWebpackPlugin({
 
-             title: '科技服务',
 
-             filename: 'html/service.html',
 
-             template: './template/service.html',
 
-             chunks: ['service', 'vendors']
 
-         }),
 
-         new HtmlWebpackPlugin({
 
-             title: '注册',
 
-             filename: 'html/register.html',
 
-             template: './template/register.html',
 
-             chunks: ['register', 'vendors']
 
-         }),
 
-         new HtmlWebpackPlugin({
 
-             title: '科技交易',
 
-             filename: 'html/technologyTrading.html',
 
-             template: './template/technologyTrading.html',
 
-             chunks: ['technologyTrading', 'vendors']
 
-         }),
 
-         new HtmlWebpackPlugin({
 
-             title: '科技智库',
 
-             filename: 'html/thinktank.html',
 
-             template: './template/thinktank.html',
 
-             chunks: ['thinktank', 'vendors']
 
-         }),
 
-         new HtmlWebpackPlugin({
 
-             title: '科技智库',
 
-             filename: 'html/financialIndex.html',
 
-             template: './template/financialIndex.html',
 
-             chunks: ['financialIndex', 'vendors']
 
-         }),
 
-     ];
 
-     if (!isDev) {
 
-         //这个使用uglifyJs压缩你的js代码
 
-         plugins.unshift(new webpack.DefinePlugin({
 
-             "process.env": {
 
-                 NODE_ENV: JSON.stringify("production")
 
-             }
 
-         }));
 
-         plugins.unshift(new webpack.optimize.UglifyJsPlugin({
 
-             minimize: true,
 
-             compress: {
 
-                 warnings: true
 
-             }
 
-         }));
 
-     }
 
-     //let staticHost = 'http://aftts.hnzhiming.com';
 
-     //let staticHost = 'http://afts.hnzhiming.com';
 
-     let staticHost = 'http://127.0.0.1';
 
-     switch (argv.env.deploy) {
 
-         case 'test':
 
-             staticHost = 'http://static.jishutao.com';
 
-             break;
 
-         case 'stage':
 
-             staticHost = 'http://aftts.hnzhiming.com';
 
-             break;
 
-         case 'prod':
 
-             staticHost = 'http://s.jishutao.com';
 
-             break;
 
-         default:
 
-             break;
 
-     }
 
-     staticHost = staticHost + '/portal/' + version + '/';
 
-     return {
 
-         entry: isWatch ? entries.watch : entries.prod,
 
-         output: {
 
-             path: path.resolve(__dirname, './build/' + argv.env.deploy + '/' + version),
 
-             filename: '[name].js',
 
-             publicPath: staticHost,
 
-             chunkFilename: 'chunks/[name].[hash:8].js'
 
-         },
 
-         module: require('./webpack/module.config.js')(theme),
 
-         resolve: {
 
-             extensions: ['.js', '.jsx']
 
-         },
 
-         plugins: plugins,
 
-         devServer: {
 
-             disableHostCheck: true,
 
-             //allowedHosts: ['aft.hnzhiming.com', 'afts.hnzhiming.com'],
 
-             headers: {
 
-                 "Access-Control-Allow-Origin": "*"
 
-             }
 
-         }
 
-     };
 
- })();
 
 
  |