Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nx/react): wrong svg import processing #12477

Merged
merged 1 commit into from Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
43 changes: 12 additions & 31 deletions packages/react/plugins/webpack.ts
Expand Up @@ -5,40 +5,21 @@ import ReactRefreshPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
export function getWebpackConfig(config: Configuration) {
config.module.rules.push({
test: /\.svg$/,
oneOf: [
// If coming from JS/TS or MDX file, then transform into React component using SVGR.
issuer: /\.(js|ts|md)x?$/,
use: [
{
issuer: /\.(js|ts|md)x?$/,
use: [
{
loader: require.resolve('@svgr/webpack'),
options: {
svgo: false,
titleProp: true,
ref: true,
},
},
{
loader: require.resolve('url-loader'),
options: {
limit: 10000, // 10kB
name: '[name].[hash:7].[ext]',
esModule: false,
},
},
],
loader: require.resolve('@svgr/webpack'),
options: {
svgo: false,
titleProp: true,
ref: true,
},
},
// Fallback to plain URL loader.
{
use: [
{
loader: require.resolve('url-loader'),
options: {
limit: 10000, // 10kB
name: '[name].[hash:7].[ext]',
},
},
],
loader: require.resolve('file-loader'),
options: {
name: '[name].[hash].[ext]',
},
},
],
});
Expand Down
1 change: 1 addition & 0 deletions scripts/depcheck/missing.ts
Expand Up @@ -96,6 +96,7 @@ const IGNORE_MATCHES_IN_PACKAGE = {
'babel-plugin-emotion',
'babel-plugin-styled-components',
'css-loader',
'file-loader',
'less-loader',
'react-refresh',
'rollup',
Expand Down