Skip to content

Commit

Permalink
improve parse
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed May 10, 2024
1 parent 16a6d40 commit d5332ed
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,13 +485,7 @@ function insertCompiledTemplate<EnvSpecificOptions>(
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,
Expand Down

0 comments on commit d5332ed

Please sign in to comment.