Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

Commit

Permalink
Fix expression-file by using require
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Apr 22, 2021
1 parent af84657 commit bd0c0f1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ try {
const filename = args['expression-file'];
name = path.basename(filename, path.extname(filename)).replace(/[^A-Za-z0-9]/g, '_');
(module as any).paths.unshift(process.cwd() + '/node_modules');
const fileContent = fs.readFileSync(filename, "utf-8");
result = guess.generateIdentifierDeclarationFile(name, eval(fileContent));
result = guess.generateIdentifierDeclarationFile(name, require(filename));
} else if (args.identifier) {
if (args.name) throw new ArgsError('Cannot use --name with --identifier');
if (args.module || args.expression) throw new ArgsError('Cannot specify more than one input');
Expand Down

0 comments on commit bd0c0f1

Please sign in to comment.