Skip to content

Commit

Permalink
fix(webpack): fix double export (#648)
Browse files Browse the repository at this point in the history
Closes #645
  • Loading branch information
gregberge authored Dec 4, 2021
1 parent d36254e commit 7595d37
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion packages/core/src/__snapshots__/transform.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ const SvgComponent = (props) => (
</svg>
)
export default SvgComponent
export { SvgComponent as Component }
export default 'logo.svg'
"
`;

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/transform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ describe('convert', () => {
{ exportType: 'named' },
]

test.each(configs)('accepts options %j', async (config) => {
const result = await convertWithAllPlugins(svgBaseCode, config)
test.each(configs)('accepts options %j', async ({ state, ...config }) => {
const result = await convertWithAllPlugins(svgBaseCode, config, state)
expect(result).toMatchSnapshot()
})

Expand Down
3 changes: 1 addition & 2 deletions packages/webpack/src/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ var SvgIcon = function SvgIcon() {
};
export { SvgIcon as ReactComponent };
export default \\"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iODhweCIgaGVpZ2h0PSI4OHB4IiB2aWV3Qm94PSIwIDAgODggODgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDQ2LjIgKDQ0NDk2KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5EaXNtaXNzPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0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BlIj48L3BhdGg+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik01MSw1MSBMMzcsMzciIGlkPSJTaGFwZSI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+Cg==\\";"
`;

exports[`webpack loader transforms file (babel: false) 1`] = `
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function svgrLoader(
callback(err)
return
}
callback(null, `${content}\n${previousExport}`)
callback(null, content)
})
})
}
Expand Down

1 comment on commit 7595d37

@vercel
Copy link

@vercel vercel bot commented on 7595d37 Dec 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.