aboutsummaryrefslogtreecommitdiff
path: root/babel-import-promise
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-09-17 23:47:10 +0800
committerSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-09-17 23:47:10 +0800
commit12f3a81cf12c6ffc24a7f2a0e8102dfba3fddf82 (patch)
treee554b5859e0135b8f644986768306d5f3ee5683e /babel-import-promise
parent7997c067ab6a69ef587a40c244caf36805a00e8c (diff)
downloadSoopyV2-12f3a81cf12c6ffc24a7f2a0e8102dfba3fddf82.tar.gz
SoopyV2-12f3a81cf12c6ffc24a7f2a0e8102dfba3fddf82.tar.bz2
SoopyV2-12f3a81cf12c6ffc24a7f2a0e8102dfba3fddf82.zip
fix on linux
Diffstat (limited to 'babel-import-promise')
-rw-r--r--babel-import-promise/babel-import-promise.mjs2
1 files changed, 1 insertions, 1 deletions
diff --git a/babel-import-promise/babel-import-promise.mjs b/babel-import-promise/babel-import-promise.mjs
index bdde752..10aee6a 100644
--- a/babel-import-promise/babel-import-promise.mjs
+++ b/babel-import-promise/babel-import-promise.mjs
@@ -19,7 +19,7 @@ export default function ({ types: t }) {
};
path.traverse(MyVisitor)
if (shouldAdd) {
- let depth = state.filename.replace(state.cwd, "").split("\\").length - 2
+ let depth = state.filename.replace(state.cwd, "").split(/[\\/]/g).length - 2
const identifier = t.identifier('Promise');
const importDefaultSpecifier = t.importDefaultSpecifier(identifier);
const importDeclaration = t.importDeclaration([importDefaultSpecifier], t.stringLiteral("../".repeat(depth) + 'PromiseV2'));