Skip to content

Commit

Permalink
Add specialized loader to include native node add-ons (decred#720)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlyp authored Sep 29, 2017
1 parent 67e5ea4 commit 3c102de
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/main.development.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ const launchDCRD = () => {
if (os.platform() == "win32") {
try {
const util = require("util");
const win32ipc = require("./node_modules/win32ipc/build/Release/win32ipc");
const win32ipc = require("./node_modules/win32ipc/build/Release/win32ipc.node");
var pipe = win32ipc.createPipe("out");
args.push(util.format("--piperx=%d", pipe.readEnd));
} catch(e) {
Expand Down Expand Up @@ -377,7 +377,7 @@ const launchDCRWallet = () => {
if (os.platform() == "win32") {
try {
const util = require("util");
const win32ipc = require("./node_modules/win32ipc/build/Release/win32ipc");
const win32ipc = require("./node_modules/win32ipc/build/Release/win32ipc.node");
var pipe = win32ipc.createPipe("out");
args.push(util.format("--piperx=%d", pipe.readEnd));
} catch (e) {
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
"package.json"
],
"extraResources": [
{ "from": "bin", "to": "bin"}
{ "from": "bin", "to": "bin"},
"*.node"
],
"win": {
"target": "nsis"
Expand Down Expand Up @@ -191,6 +192,7 @@
"lodash": "^4.17.4",
"material-ui": "^0.17.4",
"mv": "^2.1.1",
"node-addon-loader": "alexlyp/node-addon-loader#master",
"prop-types": "^15.5.10",
"qr-image": "^3.2.0",
"react": "^15.3.2",
Expand Down
13 changes: 9 additions & 4 deletions webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,17 @@ export default {
limit: 8192
}
}]
}, {
},
{
test: /\.node$/,
use: [{
loader: "node-loader"
loader: "node-addon-loader",
options: {
basePath: path.resolve(__dirname, "bin")
}
}]
},]
}
]
},

output: {
Expand All @@ -49,7 +54,7 @@ export default {
// https://webpack.github.io/docs/configuration.html#resolve
resolve: {
extensions: [".js", ".jsx", ".json", ".node"],
mainFields: ["webpack", "browser", "web", "browserify", ["jam", "main"], "main"],
mainFields: ["webpack", "browser", "web", "browserify", ["jam", "main"], "main"]
},

plugins: [],
Expand Down

0 comments on commit 3c102de

Please sign in to comment.