Skip to content

Commit

Permalink
do not error on missing import when fail option is false
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed Dec 5, 2020
1 parent af97d20 commit 4acaa10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions lib/import-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,13 @@ const importProcessors = {
const imp = findImport(element.tag.split('.')[0]);
if (findBlockParams(element.tag.split('.')[0], p)) return;
if (builtInComponents.includes(element.tag)) return;
if (!imp && this.options.failOnMissingImport) {
throw new Error('could not find import for element ' + element.tag + ' in ' + relativePath);
} else {
console.log('warn', 'could not find import for element ' + element.tag + ' in ' + relativePath);
return;
if (!imp) {
if (this.options.failOnMissingImport) {
throw new Error('could not find import for element ' + element.tag + ' in ' + relativePath);
} else {
console.log('warn', 'could not find import for element ' + element.tag + ' in ' + relativePath);
return;
}
}
if (imp) {
const resolvedPath = importProcessors.resolvePath(imp, element.tag);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ember-template-imports",
"version": "0.2.13",
"version": "0.2.14",
"repository": {
"type": "git",
"url": "https://github.com/patricklx/ember-template-imports"
Expand Down

0 comments on commit 4acaa10

Please sign in to comment.