mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 06:03:38 +08:00
fix: fix tsconfig error in stackblitz (#41011)
* fix: fix tsconfig error in stackblitz & codesandbox * fix: fix tsconfig error in stackblitz & codesandbox
This commit is contained in:
parent
5bdc15ea37
commit
8cf4a4cb15
@ -8,26 +8,26 @@ import type { Project } from '@stackblitz/sdk';
|
||||
import stackblitzSdk from '@stackblitz/sdk';
|
||||
import { Alert, Badge, Space, Tooltip } from 'antd';
|
||||
import classNames from 'classnames';
|
||||
import LZString from 'lz-string';
|
||||
import React, { useContext, useEffect, useRef, useState } from 'react';
|
||||
import CopyToClipboard from 'react-copy-to-clipboard';
|
||||
import type { IPreviewerProps } from 'dumi';
|
||||
import { FormattedMessage, useSiteData } from 'dumi';
|
||||
import Prism from 'prismjs';
|
||||
import JsonML from 'jsonml.js/lib/utils';
|
||||
import toReactElement from 'jsonml-to-react-element';
|
||||
import { ping } from '../../utils';
|
||||
import ClientOnly from '../../common/ClientOnly';
|
||||
import JsonML from 'jsonml.js/lib/utils';
|
||||
import LZString from 'lz-string';
|
||||
import Prism from 'prismjs';
|
||||
import React, { useContext, useEffect, useRef, useState } from 'react';
|
||||
import CopyToClipboard from 'react-copy-to-clipboard';
|
||||
import useLocation from '../../../hooks/useLocation';
|
||||
import BrowserFrame from '../../common/BrowserFrame';
|
||||
import EditButton from '../../common/EditButton';
|
||||
import ClientOnly from '../../common/ClientOnly';
|
||||
import CodePenIcon from '../../common/CodePenIcon';
|
||||
import CodePreview from '../../common/CodePreview';
|
||||
import CodeSandboxIcon from '../../common/CodeSandboxIcon';
|
||||
import RiddleIcon from '../../common/RiddleIcon';
|
||||
import EditButton from '../../common/EditButton';
|
||||
import ExternalLinkIcon from '../../common/ExternalLinkIcon';
|
||||
import RiddleIcon from '../../common/RiddleIcon';
|
||||
import type { SiteContextProps } from '../../slots/SiteContext';
|
||||
import SiteContext from '../../slots/SiteContext';
|
||||
import useLocation from '../../../hooks/useLocation';
|
||||
import { ping } from '../../utils';
|
||||
|
||||
const { ErrorBoundary } = Alert;
|
||||
|
||||
@ -209,17 +209,17 @@ const CodePreviewer: React.FC<IPreviewerProps> = (props) => {
|
||||
</html>
|
||||
`;
|
||||
|
||||
const tsconfig = `
|
||||
{
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx",
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"esModuleInterop": true,
|
||||
"moduleResolution": "node",
|
||||
}
|
||||
}
|
||||
`;
|
||||
const tsconfig = {
|
||||
compilerOptions: {
|
||||
target: 'esnext',
|
||||
module: 'esnext',
|
||||
esModuleInterop: true,
|
||||
moduleResolution: 'node',
|
||||
jsx: 'react',
|
||||
jsxFactory: 'React.createElement',
|
||||
jsxFragmentFactory: 'React.Fragment',
|
||||
},
|
||||
};
|
||||
|
||||
const suffix = codeType === 'tsx' ? 'tsx' : 'js';
|
||||
|
||||
@ -367,8 +367,9 @@ createRoot(document.getElementById('container')).render(<Demo />);
|
||||
'index.html': html,
|
||||
},
|
||||
};
|
||||
|
||||
if (suffix === 'tsx') {
|
||||
stackblitzPrefillConfig.files['tsconfig.json'] = tsconfig;
|
||||
stackblitzPrefillConfig.files['tsconfig.json'] = JSON.stringify(tsconfig, null, 2);
|
||||
}
|
||||
|
||||
const backgroundGrey = theme.includes('dark') ? '#303030' : '#f0f2f5';
|
||||
|
Loading…
Reference in New Issue
Block a user