babel-plugin-preval icon indicating copy to clipboard operation
babel-plugin-preval copied to clipboard

Bug: throw Unexpected Name when pass string literal

Open osddeitf opened this issue 3 years ago • 0 comments

  • babel-plugin-preval version: 5.0.0 (preval.macro 3.0.0)
  • node version: v14.16.1
  • npm (or yarn) version: 6.14.12

Relevant code or config

export const searchPosts = preval`
  const tool = require('../../graphql/utils');
  module.exports = tool.maxDepth("searchPosts", 2);
`

What happened: The "searchPosts" supposed to be a string literal, but this is what happened

preval.macro: Syntax Error: Unexpected Name "searchPosts". Learn more: https://www.npmjs.com/package/preval.macro

Reproduction repository: I'll provide it when needed

osddeitf avatar Aug 07 '21 20:08 osddeitf