fix(babel-utils): resolve node_module templates to relative paths (#1645)

This commit is contained in:
Dylan Piercey 2021-01-13 14:37:30 -07:00 committed by GitHub
parent 0c6e968b4e
commit db4232e1e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ import path from "path";
import { types as t } from "@marko/babel-types";
const IMPORTS_KEY = Symbol();
const FS_ROOT_DIR = path.parse(process.cwd()).root;
const toPosix =
path.sep === "/"
@ -17,7 +18,7 @@ const toPosix =
};
export function resolveRelativePath(file, request) {
if (request[0] === ".") {
if (!request.startsWith(FS_ROOT_DIR)) {
return request;
}