Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

fix: fallback loader will be used than limit is equal or greater #179

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions README.md
Expand Up @@ -94,11 +94,10 @@ For example, to set the quality option of a responsive-loader above use:
Type: `Number`
Default: `undefined`

A `Number` specifying the maximum size of a file in bytes. If the file is
greater than the limit,
[`file-loader`](https://github.com/webpack-contrib/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.
A `Number` specifying the maximum size of a file in bytes. If the file size is
**equal** or **greater** than the limit [`file-loader`](https://github.com/webpack-contrib/file-loader)
will be 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.

Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -31,7 +31,7 @@ export default function loader(src) {
const mimetype = options.mimetype || mime.getType(file);

// No limit or within the specified limit
if (!limit || src.length < limit) {
if (!limit || src.length <= limit) {
if (typeof src === 'string') {
src = Buffer.from(src);
}
Expand Down