From 6af9ab68a8d5f22fce0a3c8b85a75706fe38ad2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Hegdahl?= Date: Mon, 16 Jan 2023 21:14:08 +0100 Subject: [PATCH] Fix 'handlebarsConfig' file not found on Windows --- CHANGELOG.md | 4 ++++ package.json | 2 +- source/utils.ts | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e14ee19..cbfbd55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.9.4 + +- Fix `handlebarsConfig` file not found on Windows + ## 1.9.3 - Fix `handlebarsConfig` file not found even when path is correct diff --git a/package.json b/package.json index 6214d6e..cab81ce 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Module Templates", "publisher": "asbjornh", "icon": "icon.png", - "version": "1.9.3", + "version": "1.9.4", "description": "A VSCode extension for creating file/folder templates for new modules", "scripts": { "vscode:prepublish": "webpack", diff --git a/source/utils.ts b/source/utils.ts index ef61cd7..57f53ea 100644 --- a/source/utils.ts +++ b/source/utils.ts @@ -81,8 +81,8 @@ export function getEngine(root: WorkspaceFolder): Engine { const tryRequire = (path: string) => { try { - // NOTE: Webpack does some shenanigans with `require` building (this does not happen when debugging the extension in VSCode) - return eval(`require("${path}")`); + // NOTE: Webpack does some shenanigans with `require` when building (this does not happen when debugging the extension in VSCode) + return eval("require")(path); } catch (error) { throw new Error( `${error.name}: ${error.message} in ${error.stack.split("\n")[0]}`,