Skip to content

Commit 2e8eb36

Browse files
committed
build(bezier-icons): refactor rollup config
1 parent 338e2ed commit 2e8eb36

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

packages/bezier-icons/rollup.config.mjs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,31 +63,30 @@ const entryModuleContent = iconImportLines
6363
.concat(exports)
6464
.join('\n')
6565

66-
const iconUtilTypes = `
67-
export declare type IconSource = React.FunctionComponent<React.SVGProps<SVGSVGElement>>
66+
const entryTypesContent = `
67+
export declare type IconSource = (props: SVGProps<SVGSVGElement>) => JSX.Element
6868
export declare type BezierIcon = IconSource & { __type: 'BezierIcon' }
6969
7070
export declare function isBezierIcon(arg: unknown): arg is BezierIcon
7171
export declare function createBezierIcon(icon: IconSource): BezierIcon
7272
7373
export declare type IconName = ${iconNames.join(' | ')}
74-
7574
/**
7675
* @deprecated If you import this module, all icons are bundled, so please import and use the individual icons.
7776
* @example
7877
* import { AllIcon } from '@channel.io/bezier-icons'
7978
*/
8079
export declare const icons: Record<IconName, BezierIcon>
81-
`.trim()
8280
83-
const entryTypesContent = `${iconUtilTypes}\n\n${iconComponentTypes.join('\n')}\n`
81+
${iconComponentTypes.join('\n')}
82+
`.trim()
8483

8584
/**
8685
* @type {import('rollup').PluginImpl}
8786
*/
8887
function emitFile({ fileName, source }) {
8988
return {
90-
name: 'emit-file',
89+
name: 'emitFile',
9190
buildEnd() {
9291
if (source.length === 0) {
9392
this.warn('source content is empty')
@@ -157,7 +156,7 @@ function svgBuild(options = {}) {
157156
const optimizedSvgs = []
158157

159158
return {
160-
name: 'buildSvg',
159+
name: 'svgBuild',
161160
async transform(code, id) {
162161
if (!filter(id) || !id.endsWith('.svg')) { return null }
163162

@@ -272,7 +271,7 @@ export default defineConfig([
272271
typescript(),
273272
svgBuild({ include: `${iconBasePath}/*.svg` }),
274273
/**
275-
* The module is not resolving well, so use the alias plugin to resolve the module.
274+
* Module resolution is not working well inside the virtual module, so use the alias plugin to resolve the module manually.
276275
*/
277276
alias({
278277
entries: [{

0 commit comments

Comments
 (0)