Skip to content

Commit

Permalink
fix: handle double quotes in ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Nov 11, 2021
1 parent ac7bd40 commit 2fefcc8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/FileSystemInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -1662,9 +1662,12 @@ class FileSystemInfo {
let dependency;
if (imp.d === -1) {
// import ... from "..."
dependency = parseString(
source.substring(imp.s - 1, imp.e + 1)
);
let expr = source.substring(imp.s - 1, imp.e + 1);
if (expr[0] === "'")
expr = `"${expr
.slice(1, -1)
.replace(/"/g, '\\"')}"`;
dependency = parseString(expr);
} else if (imp.d > -1) {
// import()
let expr = source.substring(imp.s, imp.e).trim();
Expand Down

0 comments on commit 2fefcc8

Please sign in to comment.