chery-pick: fix(ct): do not break if there are no components (2)

This commit is contained in:
Pavel Feldman 2022-05-23 14:37:56 -07:00
parent 95614581db
commit 38fe4a5102

View file

@ -77,7 +77,7 @@ export function createPlugin(
// 2. Check if the set of required components has changed. // 2. Check if the set of required components has changed.
const hasNewComponents = await checkNewComponents(buildInfo, componentRegistry); const hasNewComponents = await checkNewComponents(buildInfo, componentRegistry);
// 3. Check component sources. // 3. Check component sources.
const sourcesDirty = hasNewComponents || await checkSources(buildInfo); const sourcesDirty = !buildExists || hasNewComponents || await checkSources(buildInfo);
viteConfig.root = rootDir; viteConfig.root = rootDir;
viteConfig.preview = { port }; viteConfig.preview = { port };
@ -85,7 +85,7 @@ export function createPlugin(
outDir outDir
}; };
const { build, preview } = require('vite'); const { build, preview } = require('vite');
if (!buildExists || sourcesDirty) { if (sourcesDirty) {
viteConfig.plugins = viteConfig.plugins || [ viteConfig.plugins = viteConfig.plugins || [
frameworkPluginFactory() frameworkPluginFactory()
]; ];