From 4b831b3d874ab151c99703b7a0100b39b99f712b Mon Sep 17 00:00:00 2001 From: patrick Date: Wed, 21 Sep 2022 12:16:32 +0200 Subject: [PATCH] also check exported member in diags --- glint/glint-hbs-imports-env.js | 7 +++++-- package.json | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/glint/glint-hbs-imports-env.js b/glint/glint-hbs-imports-env.js index 34390ef..b1d9ad7 100644 --- a/glint/glint-hbs-imports-env.js +++ b/glint/glint-hbs-imports-env.js @@ -132,8 +132,11 @@ const patchedRewriteDiagnostics = function (diagnostics, fileName) { console.error('patchedRewriteDiagnostics'); const diags = rewriteDiagnostics.call(this, diagnostics, fileName); diags.forEach((d) => { - const regex = /Cannot find module '(.*)' or its corresponding type declarations./; - const result = d.messageText.match?.(regex); + const regexs = [ + /Cannot find module '(.*)' or its corresponding type declarations./, + /Namespace '(.*)' has no exported member/ + ]; + const result = regexs.map(r => d.messageText.match?.(r)).find(r => r && result.length > 1) if (result && result.length > 1) { const importPath = result[1]; const rel = path.relative(cwd, d.file.fileName).replace(/\\/g, '/'); diff --git a/package.json b/package.json index 31862ec..c2bb08f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ember-hbs-imports", - "version": "0.5.9", + "version": "0.5.10", "repository": { "type": "git", "url": "https://github.com/patricklx/ember-hbs-imports"