webpack.js
file.jpg: transform to base64 by url-loader
file.png: use file-loader
just use the ext to decide all file.jpg in project to transform。
but how to deal the file.gif?
indeed I want to know how to config the url-loader in webpack to transform only some folders or some files?but not just all files of some types.
sorry,my english is poor...
rules:{
{
test: /\.(png|svg|ttf|eot|woff|otf)$/,
loader: 'file-loader',
options: {
name: '[path][name].[ext]?[hash]'
}
},
{
test: /\.(gif|jpg)$/,
loader: 'url-loader',//url-loader?limit=30000
options: {
limit:30000,
name: '[path][name].[ext]?[hash]',
},
exclude: ////don't know how to config
}
}