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

Commit

Permalink
fix: fallback loader will be used than limit is equal or greater (#179)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: fix: fallback loader will be used than limit is equal or greater
  • Loading branch information
evilebottnawi authored Jun 5, 2019
1 parent a6705cc commit 3c24545
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 6 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading

0 comments on commit 3c24545

Please sign in to comment.