Skip to content

Commit 3f85a4a

Browse files
committed
fix(gen): relativeRequire always returns posix style paths
1 parent 812326f commit 3f85a4a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: util.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ function relativeRequire (self, to, fr) {
8888
fr = destinationPath(self, fr);
8989
to = destinationPath(self, to);
9090
return path.relative(path.dirname(fr), to)
91-
.replace(/^(?!\.\.)(.*)/, './$1')
92-
.replace(/[\/\\]index\.js$/, '');
91+
.replace(/\\/g, '/') // convert win32 separator to posix
92+
.replace(/^(?!\.\.)(.*)/, './$1') // prefix non parent path with ./
93+
.replace(/[\/\\]index\.js$/, ''); // strip index.js suffix from path
9394
}
9495

9596
function filterFile (template) {

0 commit comments

Comments
 (0)