node.js - Code Protection?

后端 未结 13 2122
感动是毒
感动是毒 2020-11-29 15:21

I want to use node.js in my next project, but my boss does not like that our competitors can read the source code.

Is there a way to protect the JavaScript code?

13条回答
  •  Happy的楠姐
    2020-11-29 15:53

    Package your core logic into modules.. these modules can be built then run through Google's closure. You could even be able to do this as a Grunt task as part of your build process.

    It's an old question but worth pointing out. Note: nothing you do will truly hide your code, but neither will anything shipped via .Net (C#) or Java for that matter. In general, simply using a tool like uglify, or closure should be enough of an obfuscation point. By being modular and using closure you can actually do a lot of optimizations that otherwise would be difficult.

提交回复
热议问题