const webpack = require("webpack");
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry : {
index : __dirname + "/src/index.js"
},
output : {
path : __dirname + "/build",
filename : "bundle.js"
},
module : {
rules : [
{
test : /\.js$/,
use : {
loader : "babel-loader",
options : {
presets : "es2015"
}
}
},
{
test : /\.css$/,
use : ExtractTextPlugin.extract({
fallback : "style-loader",
use : "css-loader"
})
},
{
test : /\.jpg$/,
use : {
loader : "url-loader",
options : {
limit : "1024",
name : "../images/[hash:8].[name].[ext]"
}
}
}
]
},
plugins : [
new ExtractTextPlugin("css/style.css")
]
}
为什么会同时在根目录和build文件夹下自动新建images文件夹?
我只想在build文件夹下自动新建images文件夹(里面有图片)
哪里配置错了吗?
你的url-loader配置有问题啊extract-text-webpack-plugin都已经在build目录生产image文件了
你url-loader name里面别加../