Skip to content

Commit eb811f7

Browse files
committed
fix: Build(webpack/rollup) - svgr - exportType:default
1 parent 26d067c commit eb811f7

File tree

7 files changed

+1056
-559
lines changed

7 files changed

+1056
-559
lines changed

.npmignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/index.*
22
bin/
33
build/
4-
src/
4+
/src/
55
dist/esm/types/src/docs/
66
assets/
77
CHANGELOG.md

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"@homecode/ui": "^4.17.2",
4444
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
4545
"@rollup/plugin-typescript": "^11.0.0",
46+
"@svgr/webpack": "^8.1.0",
4647
"classnames": "^2.3.2",
4748
"compareq": "^1.2.2",
4849
"fastest-validator": "^1.16.0",
@@ -104,7 +105,6 @@
104105
"postcss-preset-env": "^8.0.1",
105106
"raw-loader": "^4.0.2",
106107
"react-hot-loader": "^4.13.1",
107-
"react-svg-loader": "^3.0.3",
108108
"replace": "^1.2.2",
109109
"rollup": "^3.17.1",
110110
"rollup-plugin-delete": "^2.0.0",

rollup.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export default [
8787

8888
json(),
8989

90-
svgr(),
90+
svgr({ exportType: 'default' }),
9191
// styles({ modules: true }),
9292
// stylusCssModules({ output: 'index.css' }),
9393

src/components/Spinner/Spinner.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import cn from 'classnames';
22

3-
import { ReactComponent as SpinnerIcon } from './spinner.svg';
3+
import SpinnerIcon from './spinner.svg';
44
import S from './Spinner.styl';
55
import * as T from './Spinner.types';
66

src/docs/components/Code/Code.styl

+11-5
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@
5454
border-radius inherit
5555
flex 1
5656

57+
@media(orientation: portrait)
58+
height 50%
59+
5760
.editorContainer
5861
position relative
5962
border-bottom-left-radius 0
@@ -142,11 +145,14 @@
142145
.editorContainer
143146
max-height 60vh
144147

145-
.preview::before
146-
left 1px
147-
right 1px
148-
height 1px
149-
width unset
148+
.preview
149+
max-height 100%
150+
151+
&::before
152+
left 1px
153+
right 1px
154+
height 1px
155+
width unset
150156

151157
@media (orientation: landscape)
152158
.preview

src/docs/config/webpack.config.js

+4-16
Original file line numberDiff line numberDiff line change
@@ -86,24 +86,12 @@ export default (env, argv) => {
8686
},
8787
{
8888
test: /\.svg$/,
89-
exclude: paths.modules,
90-
oneOf: [
91-
{
92-
issuer: /\.(t|j)sx?$/,
93-
use: [
94-
{
95-
loader: 'babel-loader',
96-
},
97-
{
98-
loader: 'react-svg-loader',
99-
},
100-
],
101-
},
89+
use: [
10290
{
103-
loader: 'file-loader',
91+
loader: '@svgr/webpack',
10492
options: {
105-
name: 'static/[name].[ext]',
106-
outputPath: 'images/',
93+
icon: true,
94+
exportType: 'default', // Set to 'default' to use default import
10795
},
10896
},
10997
],

0 commit comments

Comments
 (0)