const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
var CleanWebpackPlugin = require('clean-webpack-plugin')
var InlineManifestWebpackPlugin = require('inline-manifest-webpack-plugin')
const path = require('path')
module.exports = {
// devtool: 'source-map',
entry: __dirname + "/app/main.js",
output: {
path: __dirname + "/build/",
filename: "js/[hash].js",
publicPath: "//mall-res.manboker.com/web/h5/charity/assets/"
},
devServer: {
contentBase: "./public",//本地服务器所加载的页面所在的目录
historyApiFallback: true,//不跳转
inline: true//实时刷新
},
module: {
rules: [
{
test: /\.(html)$/,
use: {
loader: 'html-loader',
options: {
minimize: true
}
}
},
{
test: /(\.jsx|\.js)$/,
use: {
loader: "babel-loader",
options: {
presets: [
"es2015"
]
}
},
exclude: /node_modules/
},
{
test: /\.(gif|jpe?g|png)$/,
include: path.join(__dirname, 'images'),
loaders: 'url-loader?limit=20000&name=imgs/[hash].[ext]'
},
{
test: /\.scss$/,
loaders: ['style-loader', 'css-loader', 'sass-loader',"postcss-loader", 'resolve-url-loader?sourceMap', 'sass-loader?sourceMap', ],
},
]
},
plugins: [
new webpack.BannerPlugin(''),
new HtmlWebpackPlugin({
template: __dirname + "/app/index.tmpl.html"
}),
new ExtractTextPlugin('css/styles.css'),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin()
],
}
网友评论