var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var config = {
entry: {
'index' : ['./src/page/index/index.js'],
'login' : ['./src/page/login/index.js'],
// 'common' : ['./src/page/common/index.js'],
},
output: {
path: __dirname+'/dist',//文件存储路径
publicPath:'/dist/',//文件访问路径
// path: './dist',//文件访问路径
filename: 'js/[name].js'
},
externals: {
'jquery' : 'window.jQuery'
},
module: {
loaders: [
// 编译css并自动添加css前缀
{
test: /\.css$/,
// loader: ExtractTextPlugin.extract({
// fallback: "style-loader",
// use: "css-loader"
// })
// loader: 'style-loader!css-loader'
loader: ExtractTextPlugin.extract("style-loader","css-loader")
// loader: ExtractTextPlugin.extract("style-loader","css-loader","postcss-loader","less-loader")
//
// ExtractTextPlugin.extract(
// 'style-loader', 'css-loader',
// {fallback : 'style-loader',
// use : 'css-loader',}
// 'less-loader'
// )
}
]
},
pulgins: [
// new webpack.optimize.CommonsChunkPlugin('common.js',['login','index']),
// 独立通用模块到js/base.js
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
filename: 'js/base.js',
// chunks:['main','login','index']
}),
// new ExtractTextPlugin({
// filename: 'css/[name].css'
// }),
],
};
module.exports = config;