Gathering detailed insights and metrics for image-webpack-loader
Gathering detailed insights and metrics for image-webpack-loader
Gathering detailed insights and metrics for image-webpack-loader
Gathering detailed insights and metrics for image-webpack-loader
npm install image-webpack-loader
Module System
Unable to determine the module system for this package.
Min. Node Version
Typescript Support
Node Version
NPM Version
2,028 Stars
330 Commits
132 Forks
16 Watching
14 Branches
38 Contributors
Updated on 20 Nov 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-16.8%
20,503
Compared to previous day
Last week
-7.9%
119,148
Compared to previous week
Last month
14%
550,882
Compared to previous month
Last year
-25%
8,202,053
Compared to previous year
10
4
please use: https://github.com/webpack-contrib/image-minimizer-webpack-plugin/
Image loader module for webpack
Minify PNG, JPEG, GIF, SVG and WEBP images with imagemin
Issues with the output should be reported on the imagemin issue tracker.
1$ npm install image-webpack-loader --save-dev
node:12-buster
No additional preparations required.
All dependencies will be compiled automatically.
Not recommended because of large image size (~1 GB).
node:12-buster-slim
Prepare script:
1apt-get update 2apt-get install -y --no-install-recommends autoconf automake g++ libpng-dev make
Recommended container image.
node:12-alpine
Prepare script:
1apk add --no-cache autoconf automake file g++ libtool make nasm libpng-dev
Not recommended because of long build time.
Container distro | Pull time | Build time | Total time |
---|---|---|---|
node:12-buster | 42 seconds | 77 seconds | 119 seconds |
node:12-buster-slim | 11 seconds | 103 seconds | 114 seconds |
node:12-alpine | 8 seconds | 122 seconds | 130 seconds |
Installing on some versions of OSX may raise errors with a missing libpng dependency:
Module build failed: Error: dyld: Library not loaded: /usr/local/opt/libpng/lib/libpng16.16.dylib
This can be remedied by installing the newest version of libpng with homebrew:
1brew install libpng
In your webpack.config.js
, add the image-loader, chained after the file-loader:
1rules: [{ 2 test: /\.(gif|png|jpe?g|svg)$/i, 3 use: [ 4 'file-loader', 5 { 6 loader: 'image-webpack-loader', 7 options: { 8 bypassOnDebug: true, // webpack@1.x 9 disable: true, // webpack@2.x and newer 10 }, 11 }, 12 ], 13}]
For each optimizer you wish to configure, specify the corresponding key in options:
1rules: [{ 2 test: /\.(gif|png|jpe?g|svg)$/i, 3 use: [ 4 'file-loader', 5 { 6 loader: 'image-webpack-loader', 7 options: { 8 mozjpeg: { 9 progressive: true, 10 }, 11 // optipng.enabled: false will disable optipng 12 optipng: { 13 enabled: false, 14 }, 15 pngquant: { 16 quality: [0.65, 0.90], 17 speed: 4 18 }, 19 gifsicle: { 20 interlaced: false, 21 }, 22 // the webp option will enable WEBP 23 webp: { 24 quality: 75 25 } 26 } 27 }, 28 ], 29}]
Comes bundled with the following optimizers, which are automatically enabled by default:
And optional optimizers:
Each optimizers can be disabled by specifying optimizer.enabled: false
, and optional ones can be enabled by simply putting them in the options
If you are using Webpack 1, take a look at the old docs (or consider upgrading).
Loader options:
Type: boolean
Default: false
Using this, no processing is done when webpack 'debug' mode is used and the loader acts as a regular file-loader. Use this to speed up initial and, to a lesser extent, subsequent compilations while developing or using webpack-dev-server. Normal builds are processed normally, outputting optimized files.
Type: boolean
Default false
Same functionality as bypassOnDebug option, but doesn't depend on webpack debug mode, which was deprecated in 2.x. Basically you want to use this option if you're running webpack@2.x or newer.
For optimizer options, an up-to-date and exhaustive list is available on each optimizer repository:
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
Found 2/9 approved changesets -- score normalized to 2
Reason
dependency not pinned by hash detected -- score normalized to 1
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
26 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn Moreimg-optimize-loader
Image webpack loader. Minify image, compress image, encode image(eg: base64) and inline image automaticlly. Support PNG, JPG, JPEG, GIF, WEBP, SVG.
asset-config-webpack-plugin
Preset for font and image webpack loader configurations
style-loader
style loader module for webpack
css-loader
css loader module for webpack