var config = {
context: __dirname,
entry: entry,
output: {
path: outputPath,
publicPath: "/",
filename: "./static/[name].bundle.js",
},
resolve: {
alias: {
"common": path.join(__dirname, '../common'),
"static": path.join(__dirname,'../static')
}
},
devtool: "source-map",
module: {
loaders:[],
rules: [{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ["react","es2015"]
}
},{
test: /\.html$/,
use: [{
loader: 'html-loader',
options: {
minimize: false,
removeAttributeQuotes : false
}
}]
},{
test: /\.(png|jpg|jpeg|gif)$/,
use: [{
loader: 'url-loader',
options: {
limit: 125,
name: "static/[hash].[name].[ext]"
}
}]
},{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: "css-loader"
})
},{
test: /\.styl$/,
loader: ExtractTextPlugin.extract({
fallback: "style-loader",
use: ["css-loader", "stylus-loader"]
})
}]
},
plugins: [
new CopyWebpackPlugin([{
from: path.join(__dirname, "../common"),
to: path.join(outputPath, "common")
},{
from: path.join(__dirname, "../static"),
to: path.join(outputPath, "static")
}]),
new ExtractTextPlugin("./static/[name].css"),
new webpack.DllReferencePlugin({
context: ".",
manifest: require(path.join(outputPath, "static", "js", "lib.manifest.json")),
})
]
}
如果是react写的index.js下引入图片是可以md5的,但是styl文件就不行