fix(react): add fallback for SVG imports coming from non-TS/JS modules (#2351)

This commit is contained in:
Jack Hsu 2020-01-21 10:06:30 -05:00 committed by GitHub
parent 1132d9ec57
commit 20885513ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,9 @@ function getWebpackConfig(config: Configuration) {
},
{
test: /\.svg$/,
oneOf: [
// If coming from JS/TS file, then transform into React component using SVGR.
{
issuer: {
test: /\.[jt]sx?$/
},
@ -31,6 +34,20 @@ function getWebpackConfig(config: Configuration) {
}
}
]
},
// Fallback to plain URL loader.
{
use: [
{
loader: 'url-loader',
options: {
limit: 10000, // 10kB
name: '[name].[hash:7].[ext]'
}
}
]
}
]
}
);