Install
yarn add -D probe-image-size-loader
Usage
Can also be used with lqip-loader.
webpack.config.js
moduleexports = module: rules: test: /\.png$/ use: 'probe-image-size-loader' 'file-loader' ;
Output
moduleexports = src: __dirname + 'some/path/to/image.png' height: 100 width: 200;
Usage in JS files
; const Image = <img src=imagesrc height=imageheight width=imagewidth />;
Example
$ cd example
$ yarn
$ yarn build
$ node dist/main.js
{
src: 'cb12bc24511449db821768715e85b0d9.gif',
height: 208,
width: 220
}