Skip to content

Commit

Permalink
fix: concat directory separators instead of "/" to make it work on Wi…
Browse files Browse the repository at this point in the history
…ndows #39

issues: #39
  • Loading branch information
vashzhong committed Mar 29, 2021
1 parent cd1e9c0 commit 602c32b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function loader(content) {

return `
try {
process.dlopen(module, __dirname + "/" + __webpack_public_path__ + ${JSON.stringify(
process.dlopen(module, __dirname + require("path").sep + __webpack_public_path__ + ${JSON.stringify(
name
)}${
typeof options.flags !== 'undefined'
Expand Down
4 changes: 2 additions & 2 deletions test/__snapshots__/loader.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports[`loader should throw an error on broken "node" addon: errors 1`] = `Arra
exports[`loader should throw an error on broken "node" addon: module 1`] = `
"
try {
process.dlopen(module, __dirname + \\"/\\" + __webpack_public_path__ + \\"broken.node\\");
process.dlopen(module, __dirname + require(\\"path\\").sep + __webpack_public_path__ + \\"broken.node\\");
} catch (error) {
throw new Error('node-loader:\\\\n' + error);
}
Expand All @@ -19,7 +19,7 @@ exports[`loader should work: errors 1`] = `Array []`;
exports[`loader should work: module 1`] = `
"
try {
process.dlopen(module, __dirname + \\"/\\" + __webpack_public_path__ + \\"hello.node\\", 1);
process.dlopen(module, __dirname + require(\\"path\\").sep + __webpack_public_path__ + \\"hello.node\\", 1);
} catch (error) {
throw new Error('node-loader:\\\\n' + error);
}
Expand Down

0 comments on commit 602c32b

Please sign in to comment.