Skip to content

Commit 9f6c57d

Browse files
committed
fix: A block compilation error would cause the template to be skipped.
1 parent c4dc125 commit 9f6c57d

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

packages/@css-blocks/glimmer/src/Analyzer.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { ResolverConfiguration } from "@glimmer/resolver";
1111
import { AST, preprocess, traverse } from "@glimmer/syntax";
1212
import { TemplateIntegrationOptions } from "@opticss/template-api";
1313
import * as debugGenerator from "debug";
14+
import * as fs from "fs";
1415

1516
import { ElementAnalyzer } from "./ElementAnalyzer";
1617
import { isEmberBuiltIn } from "./EmberBuiltins";
@@ -81,15 +82,14 @@ export class GlimmerAnalyzer extends Analyzer<TEMPLATE_TYPE> {
8182
}
8283

8384
private async resolveBlock(dir: string, componentName: string): Promise<Block | undefined> {
84-
try {
85-
let blockFile = await this.resolver.stylesheetFor(dir, componentName);
86-
if (!blockFile) {
87-
this.debug(`Analyzing ${componentName}. No block for component. Returning empty analysis.`);
88-
return undefined;
89-
}
90-
return await this.blockFactory.getBlockFromPath(blockFile.path);
91-
} catch (e) {
92-
this.debug(e);
85+
let blockFile = await this.resolver.stylesheetFor(dir, componentName);
86+
if (!blockFile) {
87+
this.debug(`Analyzing ${componentName}. No block for component. Returning empty analysis.`);
88+
return undefined;
89+
}
90+
if (fs.existsSync(blockFile.path)) {
91+
return this.blockFactory.getBlockFromPath(blockFile.path);
92+
} else {
9393
this.debug(`Analyzing ${componentName}. No block for component. Returning empty analysis.`);
9494
return undefined;
9595
}

0 commit comments

Comments
 (0)