mirror of https://github.com/webpack/webpack.git
31 lines
469 B
JavaScript
31 lines
469 B
JavaScript
"use strict";
|
|
|
|
const svgToMiniDataURI = require("mini-svg-data-uri");
|
|
|
|
module.exports = {
|
|
output: {
|
|
assetModuleFilename: "images/[hash][ext]"
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(png|jpg)$/,
|
|
type: "asset"
|
|
},
|
|
{
|
|
test: /\.svg$/,
|
|
type: "asset",
|
|
generator: {
|
|
dataUrl: content => {
|
|
if (typeof content !== "string") {
|
|
content = content.toString();
|
|
}
|
|
|
|
return svgToMiniDataURI(content);
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
};
|