Skip to content

Commit 3c6a54c

Browse files
authoredJul 19, 2022
fix: fix duplicate plugin/preset detected error (#747)
Closes: #746
1 parent d2a2f07 commit 3c6a54c

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed
 

‎packages/babel-preset/src/index.test.ts

+20
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,26 @@ describe('preset', () => {
132132
`)
133133
})
134134

135+
it('handles descProp and titleProp', () => {
136+
expect(
137+
testPreset('<svg></svg>', {
138+
titleProp: true,
139+
descProp: true,
140+
}),
141+
).toMatchInlineSnapshot(`
142+
"import * as React from \\"react\\";
143+
144+
const SvgComponent = ({
145+
title,
146+
titleId,
147+
desc,
148+
descId
149+
}) => <svg aria-labelledby={titleId} aria-describedby={descId}>{desc ? <desc id={descId}>{desc}</desc> : null}{title ? <title id={titleId}>{title}</title> : null}</svg>;
150+
151+
export default SvgComponent;"
152+
`)
153+
})
154+
135155
it('handles replaceAttrValues', () => {
136156
expect(
137157
testPreset('<svg a="#000" b="#fff" />', {

‎packages/babel-preset/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const plugin = (_: ConfigAPI, opts: Options) => {
143143
}
144144

145145
if (opts.descProp) {
146-
plugins.push([svgDynamicTitle, { tag: 'desc' }])
146+
plugins.push([svgDynamicTitle, { tag: 'desc' }, 'desc'])
147147
}
148148

149149
if (opts.native) {

1 commit comments

Comments
 (1)

vercel[bot] commented on Jul 19, 2022

@vercel[bot]

Successfully deployed to the following URLs:

svgr – ./

api.react-svgr.com
svgr-gregberge.vercel.app
svgr-git-main-gregberge.vercel.app

Please sign in to comment.