@elexpr/xhref-svg-loader
v1.0.3
Published
Webpack loader for svg-icons, without inlined code
Downloads
1
Readme
Configure:
const xhrefSvgLoader = require('xhref-svg-loader');
modules.exports = {
modules: {
rules: [
{
issuer: { and: [/\.(js|ts|md)x?$/u] },
test: /\.svg$/u,
use: [
{
loader: 'babel-loader',
},
{
loader: 'xhref-svg-loader',
options: {
dir: '/icons',
},
},
],
exclude: /\.animated.svg$/u, // mark animated svg for excluding
}
]
},
resolveLoader: {
alias: {
'xhref-svg-loader': xhrefSvgLoader,
}
}
}
and
// declaration.d.ts
declare module '*.svg' {
const content: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
export default content;
}
and (tsconfig.json
)
{
"include": [
"declaration.d.ts"
]
}