fix: demos can‘t be opened correctly in CodeSandbox (#13734)

This commit is contained in:
kenve 2018-12-20 16:47:11 +08:00 committed by zombieJ
parent 422b20993b
commit 6106e459a3

View File

@ -169,12 +169,12 @@ export default class Demo extends React.Component {
const dependencies = sourceCode.split('\n').reduce(
(acc, line) => {
const matches = line.match(/import .+? from '(.+)';$/);
if (matches && matches[1]) {
if (matches && matches[1] && !line.includes('antd')) {
acc[matches[1]] = 'latest';
}
return acc;
},
{ react: 'latest', 'react-dom': 'latest' },
{ react: 'latest', 'react-dom': 'latest', antd: 'latest' },
);
const codesanboxPrefillConfig = {
files: {