Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR authored Apr 10, 2024
1 parent 17e6bee commit ed0a15e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const fs = require('fs');
const path = require('path');
const { debuglog } = require('util');
const appModulePath = require('app-module-path');
const isRelative = require('is-relative-path');
const sassLookup = require('sass-lookup');
const stylusLookup = require('stylus-lookup');
const { createMatchPath } = require('tsconfig-paths');
Expand Down Expand Up @@ -479,7 +478,7 @@ function resolveWebpackPath({ dependency, filename, directory, webpackConfig })
// we only wnat the path of the resolved file
dependency = stripLoader(dependency);

const lookupPath = isRelative(dependency) ?
const lookupPath = isRelativePath(dependency) ?
path.dirname(filename) :
directory;

Expand All @@ -499,3 +498,15 @@ function stripLoader(dependency) {

return dependency.slice(exclamationLocation + 1);
}

/**
* @param {String} filename
* @return {Boolean}
*/
function isRelativePath(filename) {
if (typeof filename !== 'string') {
throw new TypeError(`Path must be a string. Received ${filename}`);
}

return filename[0] === '.';
};

Check failure on line 512 in index.js

View workflow job for this annotation

GitHub Actions / lint

Expected blank line before this statement.

Check failure on line 512 in index.js

View workflow job for this annotation

GitHub Actions / lint

Unnecessary semicolon.

0 comments on commit ed0a15e

Please sign in to comment.