Skip to content

Commit

Permalink
build: fix circular dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
himself65 committed Sep 17, 2022
1 parent f64d6d6 commit 268777c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const outputMatrix = (
}

const buildMatrix = (input: string, output: string): RollupOptions => {
dtsOutput.add([input.replaceAll('.jsx', '.d.ts'), output])
dtsOutput.add([input.replaceAll('.js', '.d.ts'), output])
return {
input,
output: outputMatrix(output),
Expand Down Expand Up @@ -79,7 +79,7 @@ const dtsMatrix = (): RollupOptions[] => {
}

const build: RollupOptions[] = [
buildMatrix('./dist/out/index.jsx', 'index'),
buildMatrix('./dist/out/index.js', 'index'),
...dtsMatrix()
]

Expand Down
9 changes: 5 additions & 4 deletions src/components/DataTypes/Object.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { Box } from '@mui/material'
import type React from 'react'
import { useMemo } from 'react'
import React, { useMemo } from 'react'

import { useTextColor } from '../../hooks/useColor'
import { useJsonViewerStore } from '../../stores/JsonViewerStore'
import type { DataItemProps } from '../../type'
import { DataKeyPair } from '../DataKeyPair'

const lb = '{'
const rb = '}'
Expand Down Expand Up @@ -61,6 +59,9 @@ export const PostObjectType: React.FC<DataItemProps<object>> = (props) => {
)
}

const KeyPair = React.lazy(() => import('../DataKeyPair').then(
({ DataKeyPair }) => ({ default: DataKeyPair })))

export const ObjectType: React.FC<DataItemProps<object>> = (props) => {
const keyColor = useTextColor()
return (
Expand All @@ -77,7 +78,7 @@ export const ObjectType: React.FC<DataItemProps<object>> = (props) => {
? (
Object.entries(props.value).map(([key, value]) => {
const path = [...props.path, key]
return <DataKeyPair key={key} path={path} value={value}/>
return <KeyPair key={key} path={path} value={value}/>
})
)
: (
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"extends": "./node_modules/@textea/dev-kit/config/tsconfig.root.json",
"compilerOptions": {
"outDir": "./dist/out/",
"rootDir": "./src/"
"rootDir": "./src/",
"jsx": "react-jsx",
"jsxImportSource": "@emotion/react"
},
"include": [
"src/**/*.ts",
Expand Down

0 comments on commit 268777c

Please sign in to comment.