diff --git a/lib/utils/style-gather.html b/lib/utils/style-gather.html index a2bb6feda1..5c4fa8ceb6 100644 --- a/lib/utils/style-gather.html +++ b/lib/utils/style-gather.html @@ -80,7 +80,13 @@ */ stylesFromModule(moduleId) { const m = importModule(moduleId); - if (m && m._styles === undefined) { + + if (!m) { + console.warn('Could not find style data in module named', moduleId); + return []; + } + + if (m._styles === undefined) { const styles = []; // module imports: styles.push(...this._stylesFromModuleImports(m)); @@ -90,12 +96,11 @@ styles.push(...this.stylesFromTemplate(template, /** @type {templateWithAssetPath} */(m).assetpath)); } + m._styles = styles; } - if (!m) { - console.warn('Could not find style data in module named', moduleId); - } - return m ? m._styles : []; + + return m._styles; }, /**