Skip to content

Commit

Permalink
fix: correctly compile custom paths on Windows
Browse files Browse the repository at this point in the history
Closes #112
  • Loading branch information
nikku committed Jul 21, 2023
1 parent dfe50fd commit bfd24f1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/support/compile-config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const path = require('path').posix;
const path = require('path');

const { isString } = require('min-dash');

Expand Down Expand Up @@ -154,11 +154,13 @@ function computeRuleImport(resolver, pkg, rule) {

// local reference, resolved relative to pkg location
if (rule.startsWith('.')) {
const pkgDir = path.dirname(resolver.require.resolve(pkg));
const pkgMain = resolver.require.resolve(pkg);

return path.normalize(`${ pkgDir }/${ rule }`);
const pkgDir = path.dirname(pkgMain.split(path.sep).join(path.posix.sep));

return path.posix.normalize(path.posix.join(pkgDir, rule));
}

// absolute reference
return path.normalize(rule);
return path.posix.normalize(rule);
}

0 comments on commit bfd24f1

Please sign in to comment.