Skip to content

Commit 7a41f1c

Browse files
authored
feat: integrate with rsbuild svgr (#75)
1 parent 61e06cf commit 7a41f1c

File tree

6 files changed

+698
-16
lines changed

6 files changed

+698
-16
lines changed

.changeset/proud-walls-fetch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@alauda/doom": minor
3+
---
4+
5+
feat: integrate with rsbuild svgr

global.d.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,18 @@
22
/// <reference types="@alauda/doom/types" />
33

44
type MDXProvidedComponents = typeof import('@alauda/doom/runtime')
5+
6+
declare module '*.module.scss' {
7+
const classes: { [key: string]: string }
8+
export default classes
9+
}
10+
11+
declare module '*.svg' {
12+
const content: string
13+
export default content
14+
}
15+
16+
declare module '*.svg?react' {
17+
const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>
18+
export default ReactComponent
19+
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@
6262
"@inquirer/prompts": "^7.5.3",
6363
"@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
6464
"@playwright/browser-chromium": "^1.52.0",
65+
"@rsbuild/plugin-react": "^1.3.2",
6566
"@rsbuild/plugin-sass": "^1.3.2",
67+
"@rsbuild/plugin-svgr": "^1.2.0",
6668
"@rsbuild/plugin-yaml": "^1.0.2",
6769
"@rspress/core": "2.0.0-beta.11",
6870
"@rspress/plugin-algolia": "2.0.0-beta.11",

shim.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
declare module '*.module.scss' {
2-
const classes: { [key: string]: string }
3-
export default classes
4-
}
5-
61
declare module 'doom-@api-crdsMap' {
72
export default crdsMap
83
}

src/cli/load-config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import fs from 'node:fs/promises'
22
import path from 'node:path'
33

4+
import { pluginReact } from '@rsbuild/plugin-react'
45
import { pluginSass } from '@rsbuild/plugin-sass'
6+
import { pluginSvgr } from '@rsbuild/plugin-svgr'
57
import { pluginYaml } from '@rsbuild/plugin-yaml'
68
import {
79
addLeadingSlash,
@@ -311,7 +313,7 @@ const getCommonConfig = async ({
311313
dev: {
312314
lazyCompilation: lazy,
313315
},
314-
plugins: [pluginSass(), pluginYaml()],
316+
plugins: [pluginReact(), pluginSass(), pluginSvgr(), pluginYaml()],
315317
server: {
316318
open,
317319
},

0 commit comments

Comments
 (0)