Skip to content

Commit

Permalink
fix: handle dobule 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 eac2ba5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/FileSystemInfo.js
Expand Up @@ -1661,10 +1661,13 @@ class FileSystemInfo {
try {
let dependency;
if (imp.d === -1) {
let expr = source.substring(imp.s - 1, imp.e + 1);
if (expr[0] === "'")
expr = `"${expr
.slice(1, -1)
.replace(/"/g, '\\"')}"`;
// import ... from "..."
dependency = parseString(
source.substring(imp.s - 1, imp.e + 1)
);
dependency = parseString(expr);
} else if (imp.d > -1) {
// import()
let expr = source.substring(imp.s, imp.e).trim();
Expand Down

0 comments on commit eac2ba5

Please sign in to comment.