I have a large project (about 80 source JS files, in a deeply nested module hierarchy), organized roughly like this:
// myproject/app/index.html
-----------------------------------
<html>
<script src="vendor/jquery.js" />
<script src="main.js" />
</html>
-----------------------------------
// myproject/app/main.js
-----------------------------------
"use strict";
var Application = require('./lib/Application');
$(document).ready(function () {
Application.initialize($, Various, Other, Globals);
});
// myproject/app/lib/Application.js
-----------------------------------
"use strict";
var Application = (function() {
var MyModule = require("./my/Module");
var MyOtherModule = require("./my/Other/Module");
function initialize ($, Various, Other, Globals) {
MyModule.doStuff();
MyOtherModule.doOtherStuff();
}
exports.initialize = initialize;
})();
Anyhow, this method of organizing my project that has been very effective so far, allowing me to run all of my code in node context (as I've mentioned before
https://github.com/nwjs/nw.js/issues/3107 ) but now that I want to take advantage of the new nwjc compiler, I don't know how to build my project. Can I individually compile all the files, maintaining their module hierarchy, or do I need to concatenate them first? Do I need to replace every "require" function call with this:
require('nw.gui').Window.get().evalNWBin(null, 'binary.bin');
If so, it's going to be very difficult to write code that works both in dev mode (with source files) and in production mode (with bin files). Any advice would be much appreciated.
Thanks!
Benji Smith