node都会 react_webpack 每次修改都要扫描 node_modules

每次修改东西,都会重新扫描 react/lib

这些库已经使用 CommonsChunkPlugin 抽离出来了

const path = require('path');

const webpack = require('webpack');

const config = require('../config/config');

const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {

entry: {

app: [

config.utils_paths.client('index.js'),

'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000'

],

vendor: ["react","react-dom"]

},

devtool: "source-map",

output: {

filename: '[name].js',

path: path.resolve(__dirname, config.utils_paths.dist()),

publicPath: '/'

},

devServer: {

hot: true,

contentBase: path.resolve(__dirname, config.utils_paths.dist()),

publicPath: '/'

},

module: {

loaders: [{

test: /\.(js|jsx)$/,

exclude: /node_modules/,

loader: 'babel-loader'

}]

},

plugins: [

new webpack.optimize.CommonsChunkPlugin({name:['vendor','manifest']}),

new HtmlWebpackPlugin({

template: config.utils_paths.client('index.html'),

hash: false,

filename: 'index.html',

inject: 'body',

minify: {

collapseWhitespace: true

}

}),

new webpack.HotModuleReplacementPlugin()

]

};

7a04ad9c9c90184c3c334aad8a11d647.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值