Skip to content

Commit 206e772

Browse files
committed
fix: build
1 parent 6465cb5 commit 206e772

File tree

10 files changed

+27
-10
lines changed

10 files changed

+27
-10
lines changed

packages/neuron-ui/.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ module.exports = {
9696
allowExpressions: true,
9797
},
9898
],
99+
'@typescript-eslint/ban-types': 'off',
99100
'import/no-unresolved': [2, { ignore: ['.svg'] }],
100101
},
101102
}

packages/neuron-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"start": "cross-env DISABLE_ESLINT_PLUGIN=true vite",
1919
"lint": "eslint --fix --ext .tsx,.ts,.js src",
2020
"test": "vitest --environment=jsdom --run --watch=false",
21-
"build": "cross-env DISABLE_ESLINT_PLUGIN=true vite build",
21+
"build": "cross-env DISABLE_ESLINT_PLUGIN=true tsc && vite build",
2222
"clean": "npx rimraf build",
2323
"precommit": "lint-staged",
2424
"storybook": "storybook dev -p 9009",

packages/neuron-ui/src/components/ErrorBoundary/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { handleViewError } from 'services/remote'
55

66
const handleError = (error: Error) => {
77
handleViewError(error.toString())
8-
if (process.env.NODE_ENV !== 'development') {
8+
if (import.meta.env.MODE !== 'development') {
99
window.location.reload()
1010
}
1111
return { hasError: true }

packages/neuron-ui/src/components/SendFieldset/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import TextField from 'widgets/TextField'
55
import Button from 'widgets/Button'
66
import Trash from 'widgets/Icons/Trash.svg?react'
77
import Attention from 'widgets/Icons/ExperimentalAttention.svg?react'
8-
import TimeClock from 'widgets/Icons/TimeClock.svg?react'
8+
import TimeClock from 'widgets/Icons/TimeClock.svg'
99

1010
import { formatDate } from 'widgets/DatetimePickerDialog'
1111
import { localNumberFormatter, isSecp256k1Address, clsx } from 'utils'

packages/neuron-ui/src/components/WalletWizard/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ const Welcome = ({ rootPath = '/wizard/', wallets = [], dispatch }: WizardElemen
151151

152152
return (
153153
<div className={styles.welcome}>
154-
<img src={`${process.env.PUBLIC_URL}/icon.png`} width="58px" className={styles.logo} alt="logo" />
154+
<img src="/icon.png" width="58px" className={styles.logo} alt="logo" />
155155
<span className={styles.slogan}>{t('wizard.welcome-to-nervos-neuron')}</span>
156156
<Button
157157
type="default"

packages/neuron-ui/src/types/global/index.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/// <reference types="vite-plugin-svgr/client" />
2+
13
declare interface Window {
24
electron: {
35
clipboard: any
@@ -13,6 +15,11 @@ declare module '*.json' {
1315
export default value
1416
}
1517

18+
declare module '*.svg' {
19+
const content: string
20+
export default content
21+
}
22+
1623
declare module '*.svg?react' {
1724
const value: string
1825
export const ReactComponent: React.FC<React.SVGProps<SVGSVGElement>>

packages/neuron-ui/src/widgets/Tabs/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ export const Tabs = <T extends {}, E extends {} = DefaultVariantProps>({
7373

7474
const combinedOnTabChange = useCallback<VariantProps<T>['onTabChange']>(
7575
id => {
76-
const selectedTab = tabs.find(tab => tab.id === id) ?? tabs[0]
77-
setSelectedTabId(selectedTab.id)
78-
onTabChange?.(selectedTab)
76+
const foundTab = tabs.find(tab => tab.id === id) ?? tabs[0]
77+
setSelectedTabId(foundTab.id)
78+
onTabChange?.(foundTab)
7979
},
8080
[onTabChange, tabs]
8181
)

packages/neuron-ui/tsconfig.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@
88
"isolatedModules": true,
99
"noEmit": true,
1010
"jsx": "preserve",
11-
"types": ["@types/jest", "vitest/globals", "@testing-library/jest-dom"],
12-
"typeRoots": ["src/types", "node_modules/@nervosnetwork/ckb-types", "node_modules/@types"],
11+
"typeRoots": [
12+
"src/types",
13+
"node_modules/@nervosnetwork/ckb-types",
14+
"node_modules/@types",
15+
"node_modules/@testing-library",
16+
"node_modules/vite"
17+
],
1318
"allowJs": true,
1419
"allowSyntheticDefaultImports": true
1520
},

packages/neuron-ui/vite-env.d..ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

packages/neuron-ui/vite.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@ export default defineConfig({
1818
postcss({
1919
autoprefixer: false,
2020
}),
21-
svgr({ include: '**/*.svg?react' }),
21+
svgr({
22+
include: '**/*.svg?react',
23+
}),
2224
...[process.env.DISABLE_ESLINT_PLUGIN === 'true' ? [] : [eslintPlugin()]],
2325
],
26+
assetsInclude: ['**/*.svg'],
2427
base: './',
2528
root: './',
2629
resolve: {

0 commit comments

Comments
 (0)