the target file cannot be generated when webpack url-loader is used
related codes
this is the webpack.config.js code
var webpack = require ("webpack");
var ExtractTextPlugin = require ("extract-text-webpack-plugin");
var HtmlWebpackPlugin = require (" html-webpack-plugin");
/ / get processing of html-webpack-login template
var getHtmlConfig=function (name) {
return {
filename: "view/"+name+".html",
template: "./src/view/"+name+".html",
inject: true,
hash:true,
chunks:["common",name]
}
}
var config = {
// htmljs
entry: {
"common": ["./src/page/common/index.js"],
"index": ["./src/page/index/index.js"],
"login": ["./src/page/login/index.js"]
},
//
output: {
path: __dirname + "/dist",//
filename: "js/[name].js",//ck,
publicPath: "./"
},
externals: {
"jquery": "window.jQuery"
},
module: {
loaders: [
{
test: /\.css$/,
loader: ExtractTextPlugin.extract("style-loader","css-loader"),
},
{
test: /\.(woff|woff2|eot|ttf|svg|jpg|png)(\?[a-z0-9]+)?$/,
loader: "url-loader?limit:10&name=resource/[name].[ext]&outputPath=img/"
},
]
},
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("login"))
],
};
module.exports = config;
this is the background image introduced by css