A Number specifying the maximum size of a file in bytes. If the file is
greater than the limit,
file-loader is used by
default and all query parameters are passed to it. Using an alternative to
file-loader is enabled via the fallback option.
The limit can be specified via loader options and defaults to no limit.
url-loader
A loader for webpack which transforms files into base64 URIs.
Requirements
This module requires a minimum of Node v6.9.0 and Webpack v4.0.0.
Getting Started
To begin, you’ll need to install
url-loader:url-loaderworks likefile-loader, but can return a DataURL if the file is smaller than a byte limit.And run
webpackvia your preferred method.Options
fallbackType:
StringDefault:'file-loader'Specifies an alternative loader to use when a target file’s size exceeds the limit set in the
limitoption.The fallback loader will receive the same configuration options as url-loader.
For example, to set the quality option of a responsive-loader above use:
limitType:
NumberDefault:undefinedA
Numberspecifying the maximum size of a file in bytes. If the file is greater than the limit,file-loaderis used by default and all query parameters are passed to it. Using an alternative tofile-loaderis enabled via thefallbackoption.The limit can be specified via loader options and defaults to no limit.
mimetypeType:
StringDefault:(file extension)Sets the MIME type for the file to be transformed. If unspecified the file extensions will be used to lookup the MIME type.
Contributing
Please take a moment to read our contributing guidelines if you haven’t yet done so.
CONTRIBUTING
License
MIT
[tests]: https://www.gitlink.org.cn/api/mirrors/umi-url-pnp-loader/raw/ https:/img.shields.io/circleci/project/github/webpack-contrib/url-loader.svg?ref=master [tests-url]: https://circleci.com/gh/webpack-contrib/url-loader