Skip to content

Commit

Permalink
Make changes compatible with node 0.10.46
Browse files Browse the repository at this point in the history
  • Loading branch information
mstade committed Oct 24, 2016
1 parent 77f0408 commit cf02eca
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint max-len: 0 */

import { basename, extname, posix } from "path";
import { basename, extname, dirname, join, normalize } from "path";
import template from "babel-template";

let buildPrerequisiteAssignment = template(`
Expand Down Expand Up @@ -148,16 +148,16 @@ export default function ({ types: t }) {

function resolveDependency(t, dependency, moduleName) {
if (moduleName.includes("/")) {
moduleName = posix.dirname(moduleName);
moduleName = dirname(moduleName);
}

let [root, ...path] = moduleName.split("/");
let resolved;

if (dependency.startsWith("./") || dependency.startsWith("../")) {
resolved = root + posix.join(`/${path.join("/")}`, posix.normalize(dependency));
resolved = root + join(`/${path.join("/")}`, dependency);
} else {
resolved = posix.normalize(dependency);
resolved = normalize(dependency);
}

return t.memberExpression(t.identifier("global"),
Expand Down

0 comments on commit cf02eca

Please sign in to comment.