diff options
Diffstat (limited to 'babel-import-promise/babel-import-promise.mjs')
-rw-r--r-- | babel-import-promise/babel-import-promise.mjs | 2 |
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')); |