Source code protection
Unlike in native applications, our source code isn't compiled and is therefore open to everybody. If you have any commercial use of this fact in mind, it is unlikely to suit you. The least you can do is to obfuscate the source code, for example, using Jscrambler (https://jscrambler.com/en/). On the other hand, we can compile our sources into native code and load it with NW.js
instead of JavaScript. For that, we need to separate JavaScript from the application bundle. Let's create the app
folder and move everything except js
there. The js
folder will be moved into a newly created directory, src
:
. ├── app │ └── assets │ └── css │ ├── Base │ └── Component └── src └── js ├── Data ├── Service └── View
Our JavaScript modules are now out of the project scope, and we cannot reach them when required. However, these are still Node.js modules (https://nodejs.org/api/modules.html) that confront CommonJS module definition...