No announcement yet.

Making a Node.JS app that needs a another module that needs another module...

  • Filter
  • Time
  • Show
Clear All
new posts

    Making a Node.JS app that needs a another module that needs another module...

    It's bridge modules all the way down! Except right at the top, my top program is nodeJS.

    I have a C# project (treasure-controller) that requires and references another C# project (random-drop-system). Both of these make use of the Netwonsoft.JSON module. I've made both projects into modules using the [assembly: Module()] attribute and the combineScripts: configuration option.

    However, this copies the *entire* contents of random-drop-system into treasure-generator, creating a very big fat file (4 megs!) and it seems to even be duplicating the contents of the Newtonsoft module, according to the error messages I"m getting from Node.

    What I'd like, ideally, is to have several completely separate modules that will have the appropriate require() calls in them, and then my node.js app just does require("treasure-generator).

    ideally, the modules and relationships would be as follows
    bridge ---> possibly requires newtonsoft-json? It gets added to all projects
    random-drop-system ---> requires bridge, newtonsoft-json
    treasure-controller ---> requires bridge, random-drop-system, newtonsoft-json

    node.js application --> requires treasure-controller, and other node stuff related to serving a web API.

    I'm thinking this seems to be the way to carve everything up into manageable files that don't exceed the script file limit, avoid duplicating code that further inflates file sizes, and make debugging from my node.js app easier.

    Is this a thing that can even be done? Do we have the parts needed to cobble this together? Am I looking at it all wrong?