Skip to content

Instantly share code, notes, and snippets.

@JamesMGreene
Last active February 6, 2018 05:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JamesMGreene/70be6f28fc3fa6875270640c5bc41d82 to your computer and use it in GitHub Desktop.
Save JamesMGreene/70be6f28fc3fa6875270640c5bc41d82 to your computer and use it in GitHub Desktop.
Trying out nexe@2.x beta native module bundling

Environment

  • Windows 10 (x64)
  • VS2015
  • Python 2.7.11
  • node@6.11.0
  • nexe@2.0.0-beta.2
  • fuse-box@2.2.1

Process

  1. Clone these files down
    • PASS
  2. npm install
    • PASS
  3. npm run bundle
    • PASS
      image
  4. npm run build-windows
    • PASS (...or so it claims!)
      image
  5. app.exe
    • FAIL HARD!
      image
const { FuseBox } = require('fuse-box')
const { NativeModulePlugin } = require('nexe/lib/bundling/fuse')
const fuse = FuseBox.init({
homeDir: './',
cache: false,
log: true,
debug: true,
output: '$name.js',
plugins: [
new NativeModulePlugin({
zmq: {
additionalFiles: [
'../../windows/lib/x64/libzmq-v100-mt-4_0_4.dll'
]
}
})
]
})
fuse.bundle('app')
.target('electron')
.instructions(`> index.js`)
fuse.run()
var zmq = require('zmq')
var pub = zmq.socket('pub')
pub.bindSync('tcp://127.0.0.1:3000')
console.log('Publisher bound to port 3000')
setInterval(function(){
console.log('sending a multipart message envelope')
pub.send(['kitty cats', 'meow!'])
}, 2500)
console.log('global', global.require.main)
var sub = zmq.socket('sub')
sub.connect('tcp://127.0.0.1:3000')
sub.subscribe('kitty cats')
console.log('Subscriber connected to port 3000')
sub.on('message', function(topic, message) {
console.log('received a message related to:', topic.toString(), 'containing message:', message.toString())
})
{
"name": "native-build",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"bundle": "node build.js",
"build-windows": "nexe --build -i app.js -o app.exe"
},
"author": "",
"license": "ISC",
"dependencies": {
"zmq": "^2.15.3"
},
"devDependencies": {
"fuse-box": "^2.2.1-beta.7",
"nexe": "^2.0.0-beta.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment