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

feat(asset): support svgr exportType usage #705

Merged
merged 1 commit into from
Jan 24, 2025
Merged

Conversation

SoonIter
Copy link
Member

@SoonIter SoonIter commented Jan 24, 2025

Summary

queryImport feature?url or ?react is not supported in bundleless mode of Rslib because every files is transformed seperatedly

BTW, bothissuer and resourceQuery are not supported in bundleless mode literally

so svgr has two usages below

1. mixedImport: true

 pluginSvgr({
 	mixedImport: true
 })
import url, { ReactComponent } from './assets/logo.svg'

2. exportType: 'default' or exportType: 'named'

this is a case when using exportType: 'default'

pluginSvgr({
 	svgrOptions: {
 	 	exportType: 'default',
 	},
 	// excluded svg files will not be transformed by svgr
 	// exclude: /logo2\.svg$/,
}),
import Comp from './assets/logo.svg'; // -> reactComponent
import url from './assets/logo2.svg'; // -> url

we currently support the first, this pr add the second usage

Related Links

#684

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copy link
Contributor

@Timeless0911 Timeless0911 left a comment

Choose a reason for hiding this comment

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

Add guides of usagae in assets docs later.

@Timeless0911 Timeless0911 merged commit f033669 into main Jan 24, 2025
18 checks passed
@Timeless0911 Timeless0911 deleted the svgr-exportType branch January 24, 2025 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants