yarn add style-loader --dev
or using npm
npm install style-loader --save-dev
It's recommended to combine svg-scaler-loader
with the @svgr/webpack
component.js
import Icon from './icon.svg'
webpack.config.js
{
module: {
rules: [
{
test: /\.svg$/,
use: [
{ loader: '@svgr/webpack' },
{
loader: 'svg-scaler-loader',
options: {
width: 24,
}
}
]
}
]
}
}
type:number
, will make the svg scale to the size by the number, will fix to square, unity all svg files to same size.
type:number
, just normal scale
, but if have the width or the height option, the scale
will not work.