We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2af4c08 commit ae9965dCopy full SHA for ae9965d
1 file changed
packages/webpack/src/index.js
@@ -41,11 +41,17 @@ function svgrLoader(source) {
41
)
42
})
43
44
- readSvg()
45
- .then(svg => convert(svg, options, { webpack: { previousExport } }))
46
- .then(jsCode => (babel ? pBabelTransform(jsCode) : jsCode))
47
- .then(result => callback(null, result))
48
- .catch(err => callback(err))
+ const tranformSvg = svg =>
+ convert(svg, options, { webpack: { previousExport } })
+ .then(jsCode => (babel ? pBabelTransform(jsCode) : jsCode))
+ .then(result => callback(null, result))
+ .catch(err => callback(err))
49
+
50
+ if (exportMatches) {
51
+ readSvg().then(tranformSvg)
52
+ } else {
53
+ tranformSvg(source)
54
+ }
55
}
56
57
export default svgrLoader
0 commit comments