Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vue-sass] Follow Symlinks for imports #379

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
18 changes: 16 additions & 2 deletions packages/vue-sass/vue-sass.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,22 @@ function discoverImportPath (importPath) {
}

for (let i = 0, potentialPath = potentialPaths[i]; i < potentialPaths.length; i++, potentialPath = potentialPaths[i]) {
if (fs.existsSync(potentialPaths[i]) && fs.lstatSync(potentialPaths[i]).isFile()) {
return potentialPath
if(fs.existsSync(potentialPath)) {
const stat = fs.lstatSync(potentialPath);

// if path is an symlink, check if the symlink points to a file
if(stat.isSymbolicLink()) {
try {
const realPath = fs.realpathSync(potentialPath);
if(fs.lstatSync(realPath).isFile()) {
return potentialPath;
}
} catch (e) {
// ignore errors
}
} else if(stat.isFile()) {
return potentialPath;
}
}
}

Expand Down