Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/model/Global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ const componetsMissingLogPrinted: Record<string, boolean> = {};

function checkMissingComponents(option: ECUnitOption) {
each(option, function (componentOption, mainType: ComponentMainType) {
if (!ComponentModel.hasClass(mainType)) {
// A `null`/`undefined` option value means the component is not actually
// used and should not be reported as missing. For example, `parseRawOption`
// injects an empty `timeline` entry into `baseOption` when using the
// `{ baseOption, media }` form without a `timeline`. See #21686.
if (componentOption != null && !ComponentModel.hasClass(mainType)) {
const componentImportName = BUITIN_COMPONENTS_MAP[mainType as keyof typeof BUITIN_COMPONENTS_MAP];
if (componentImportName && !componetsMissingLogPrinted[componentImportName]) {
error(`Component ${mainType} is used but not imported.
Expand Down
29 changes: 29 additions & 0 deletions test/ut/spec/model/componentMissing.test.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.