From e46410235bda8790020678a009c7a601a2a807c0 Mon Sep 17 00:00:00 2001 From: Ruthenic Date: Thu, 1 Sep 2022 18:23:16 -0400 Subject: [PATCH] add special workarounds for typescript(?) --- src/main.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main.js b/src/main.js index 0defbf3..a802c0a 100644 --- a/src/main.js +++ b/src/main.js @@ -26,16 +26,19 @@ export default function preprocess(opts) { delete parent[prop] } return //ignore childs of objects ie console.log - } else if (node.type === "Identifier") { + } else if (node.type === "Identifier" && !parent.type.startsWith("TS")) { + if (parent.type === "VariableDeclarator") { + return + } if (opts.values) { for (const i in opts.values) { if (i === node.name) { console.log(`Found comp-time var ${i} with value ${opts.values[i]}`) const res = eval(`(${opts.values[i]})`) if (typeof res === "string") { - parent[prop] = [ parse(`('${res}')`).body[0].expression ] + parent[prop] = [ rollupThis.parse(`('${res}')`).body[0].expression ] } else { - parent[prop] = [ parse(`(${res})`).body[0].expression ] + parent[prop] = [ rollupThis.parse(`(${res})`).body[0].expression ] } return }