From d5332edc086808488b7bff598519c2c1a2c11221 Mon Sep 17 00:00:00 2001 From: patrickpircher Date: Fri, 10 May 2024 15:18:26 +0200 Subject: [PATCH] improve parse --- src/plugin.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/plugin.ts b/src/plugin.ts index cbe4e03..3936603 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -485,13 +485,7 @@ function insertCompiledTemplate( precompileResultString = opts.compiler.precompile(template, options); } - let precompileResultAST = babel.parse(`var precompileResult = ${precompileResultString}; `, { - babelrc: false, - configFile: false, - }) as t.File; - - let templateExpression = (precompileResultAST.program.body[0] as t.VariableDeclaration) - .declarations[0].init as t.Expression; + let templateExpression = babel.template.expression.ast(precompileResultString); t.addComment( templateExpression,