I'm using webpack's url-loader plugin and have it configured as:
{
test: /\.(ttf|eot|woff|woff2|svg)$/,
loader: "url-loader?limit=50000"
}
It output files > 50k to the file system, but I can't find how to set a destination path.
In this case, I want the files to be stored to ./fonts
and not the root.
url-loader is build on file-loader, so you can use it like file-loader, as shown below:
{
test: /\.(ttf|eot|woff|woff2|svg)$/,
loader: "url-loader?limit=50000&name=fonts/[name].[ext]"
}
you can write it like this
{
test: /\.(png|woff|eot|ttf|svg|gif)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 10000, // if less than 10 kb, add base64 encoded image to css
name: "assets/[hash].[ext]" // if more than 10 kb move to this folder in build using file-loader
}
}]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With