From 7e8de86bba7bb01dbbf1c44735090bae2fe4e81a Mon Sep 17 00:00:00 2001 From: Slava Kim Date: Fri, 24 Jul 2015 11:33:10 -0700 Subject: [PATCH] In Stylus resolve relative paths with path.join --- packages/stylus/plugin/compile-stylus.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/stylus/plugin/compile-stylus.js b/packages/stylus/plugin/compile-stylus.js index f2c22b53c7..dc74e237e7 100644 --- a/packages/stylus/plugin/compile-stylus.js +++ b/packages/stylus/plugin/compile-stylus.js @@ -63,9 +63,15 @@ class StylusCompiler extends MultiFileCachingCompiler { // relative path in the same package const parsedImporter = parseImportPath(importerPath, null); + + // resolve path if it is absolute or relative + const importPath = + (filePath[0] === '/') ? filePath : + path.join(path.dirname(parsedImporter.pathInPackage), filePath); + return { packageName: parsedImporter.packageName, - pathInPackage: path.resolve(parsedImporter.pathInPackage, filePath) + pathInPackage: importPath }; }