Skip to content

Commit

Permalink
fix: dlopen relative part problem in mac system
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxxxz authored Oct 14, 2024
1 parent a0ed6c7 commit 0507d0b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export default function loader(content) {

return `
try {
process.dlopen(module, __dirname + require("path").sep + __webpack_public_path__ + ${JSON.stringify(
process.dlopen(module, require("path").join(__dirname, __webpack_public_path__, ${JSON.stringify(
name
)}${
)})${
typeof options.flags !== "undefined"
? `, ${JSON.stringify(options.flags)}`
: ""
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 + require(\\"path\\").sep + __webpack_public_path__ + \\"broken.node\\");
process.dlopen(module, require(\\"path\\").join(__dirname, __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 + require(\\"path\\").sep + __webpack_public_path__ + \\"hello.node\\", 1);
process.dlopen(module, require(\\"path\\").join(__dirname, __webpack_public_path__, \\"hello.node\\"), 1);
} catch (error) {
throw new Error('node-loader:\\\\n' + error);
}
Expand Down

0 comments on commit 0507d0b

Please sign in to comment.