Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 3eb7041

Browse files
authored
fix: concat directory separators instead of "/" to make it work on Windows #39 (#40)
1 parent 2a3cdbf commit 3eb7041

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function loader(content) {
2929

3030
return `
3131
try {
32-
process.dlopen(module, __dirname + "/" + __webpack_public_path__ + ${JSON.stringify(
32+
process.dlopen(module, __dirname + require("path").sep + __webpack_public_path__ + ${JSON.stringify(
3333
name
3434
)}${
3535
typeof options.flags !== 'undefined'

test/__snapshots__/loader.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports[`loader should throw an error on broken "node" addon: errors 1`] = `Arra
55
exports[`loader should throw an error on broken "node" addon: module 1`] = `
66
"
77
try {
8-
process.dlopen(module, __dirname + \\"/\\" + __webpack_public_path__ + \\"broken.node\\");
8+
process.dlopen(module, __dirname + require(\\"path\\").sep + __webpack_public_path__ + \\"broken.node\\");
99
} catch (error) {
1010
throw new Error('node-loader:\\\\n' + error);
1111
}
@@ -19,7 +19,7 @@ exports[`loader should work: errors 1`] = `Array []`;
1919
exports[`loader should work: module 1`] = `
2020
"
2121
try {
22-
process.dlopen(module, __dirname + \\"/\\" + __webpack_public_path__ + \\"hello.node\\", 1);
22+
process.dlopen(module, __dirname + require(\\"path\\").sep + __webpack_public_path__ + \\"hello.node\\", 1);
2323
} catch (error) {
2424
throw new Error('node-loader:\\\\n' + error);
2525
}

0 commit comments

Comments
 (0)