webpack配置
2021-06-08 10:04
标签:entry html模板 win nim false dir text ttext .com 在更目录下新建webpack.config.js module.exports= { entry: { output: { path : __dirname + ‘/dist/‘, } webpack配置 标签:entry html模板 win nim false dir text ttext .com 原文地址:http://www.cnblogs.com/xj198197/p/7307888.html
‘common‘ : [‘./src/page/common/index.js‘],
‘index‘ : [‘./src/page/index/index.js‘],
},
publicPath : ‘dev‘ === WEBPACK_ENV ? ‘/dist/‘ : ‘//s.happymmall.com/mmall-fe/dist/‘,
filename : ‘js/[name].js‘
},
externals : {
‘jquery‘ : ‘window.jQuery‘
},
module: {
loaders: [
{ test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader","css-loader") },
{ test: /\.(gif|png|jpg|woff|svg|eot|ttf)\??.*$/, loader: ‘url-loader?limit=100&name=resource/[name].[ext]‘ },
{
test: /\.string$/,
loader: ‘html-loader‘,
query : {
minimize : true,
removeAttributeQuotes : false
}
}
]
},
resolve : {
alias : {
node_modules : __dirname + ‘/node_modules‘,
util : __dirname + ‘/src/util‘,
page : __dirname + ‘/src/page‘,
}
},
plugins: [
// 独立通用模块到js/base.js
new webpack.optimize.CommonsChunkPlugin({
name : ‘common‘,
filename : ‘js/base.js‘
}),
// 把css单独打包到文件里
new ExtractTextPlugin("css/[name].css"),
// html模板的处理
new HtmlWebpackPlugin(getHtmlConfig(‘index‘, ‘首页‘)),
new HtmlWebpackPlugin(getHtmlConfig(‘list‘, ‘商品列表‘)),
]
上一篇:CURL访问举例