From 5d9dbeed7c66f12dbf9af939a7c8624430756e05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8F=B5=E4=B9=8B?= Date: Thu, 11 Jan 2024 10:42:26 +0800 Subject: [PATCH] chore(BuildTool): compatible no demo index.tsx for start --- tools/serve/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/serve/index.ts b/tools/serve/index.ts index d6dccd78ac..6874caf9a9 100644 --- a/tools/serve/index.ts +++ b/tools/serve/index.ts @@ -14,7 +14,7 @@ import createDocParser from '@alifd/doc-parser'; import MagicString from 'magic-string'; import { kebabCase } from 'lodash'; import { glob } from 'glob'; -import { ARGV, SRC_DIR_PATH, TARGETS, findFile, logger, parseImportDeclarations } from '../utils'; +import { ARGV, SRC_DIR_PATH, TARGETS, findFile, logger, parseImportDeclarations, warn } from '../utils'; import { marked } from '../build/docs/utils'; import { parseDemoMd } from '../build/docs/generate-docs'; @@ -81,6 +81,11 @@ const demoPlugin = (dirName: string): VitePlugin => { cssEntry: existsSync(cssEntryPath) ? cssEntryPath : undefined, jsEntry: existsSync(demoEntryPath) ? demoEntryPath : undefined, }; + }).filter(t => { + if (!t.jsEntry) { + warn(`Not found demo index.tsx: ${t.id}`) + } + return !!t.jsEntry }); } const SCSS_REG = /^__scss/;