简体   繁体   中英

steps to compile Node.js source into byte code and use it

WE had developed a project in nodejs. Client will distribute/sell the application with their clients, hence I must needed to hide them(compile) rather than delivering source code. please provide me proper steps from beginning to compile them, and use them.

Did you see this answer: Can I make Node.JS app self executable?

Let me requote it:

  1. Download and Install JXcore
  2. Go to your apps folder
  3. Run jx package index.js myapp -native

您可以使用node-webkit它将为Windows,Linux和Mac OS构建可执行文件。

I've had good experiences in using uglify.js to.. well uglify everything, then i pass through a hand written function that changes identifier calls to their hex version with a header (eg hello becomes a-48656c6c6f), then run what's left through either PKG (available on npm) or tar it up and write a loader in pgk that loads the tar into it's snapshot at compile, and boom your program logic is only ever loaded into memory at runtime. Still not foolproof, but at least at this point if they got through then they could have just wrote it themselves. Sorry for the revive btw, hope this helps someone as 4 years later this is still a grey area

Edit You could also (if your comfortable with JavaScript, V8 api, and c++) write a native module and bundle the native module with some loader module. Sorry trying to be informative and consise (typing on mobile is a pain)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM