In my webpack config, I want the file-loader plugin to drop all referenced images in the ./dist/images/
folder (including SVGs). At the same time, I would like the file-loader plugin to also drop all referenced font files (for font-awesome) in the ./dist/assets/webfonts/
folder (this, too, includes SVGs).
The problem I'm having is that standard SVG images are being copied to the ./dist/assets/webfonts/
AND ./dist/images/
folders and font SVGs from font-awesome are being copied to the ./dist/images/
AND ./dist/assets/webfonts/
folders.
But worse than that, all the SVGs in the ./dist/images/
don't contain SVG data, they contain this:
module.exports = __webpack_public_path__ + "./assets/webfonts/logo-text.svg";
This is my current module configuration for the file-loader plugin:
{ test: /.*\.(gif|png|jpe?g|svg)$/, loader: "file-loader", options: { name: "./images/[name]_[hash:7].[ext]" }, exclude: __dirname + "/../src/assets/" },
{ test: /.*\.(ttf|eot|woff|woff2|svg)$/, loader: "file-loader", options: { name: "./assets/webfonts/[name].[ext]" }, exclude: __dirname + "/../src/images/" }
You'll notice that for each file-loader entry, I've already excluded the folder it isn't supposed to load files from but that doesn't seem to have worked.
Any ideas on how to fix this?