I originally asked this question on the community slack, but it makes more sense to ask it here:
require a module in Fuse, our implementation supports nodejs-style require-as-directory, where
require("moduledir") works if
moduledir/index.js exists. Personally I prefer this quite a bit to
require("module/module") as it formalises the entry-point; Best practises in Fuse when writing business logic is to establish a single entry point that interfaces with other modules/features.
In a lot of ways JS in Fuse can be compared to writing JS for Electron, with some JS written for the main thread (fuse model) and other JS written for the renderer (fuse view-models) and I’d like to reinforce this kind of thinking.
My hope is that it’ll naturally inch people towards requiring their model entrypoint as the single interface used in view-models, rather than sprinkle different requires based on which feature you want (which can make for pretty ugly JS on the model side anyway).
I also think it makes sense to imagine JS business logic for Fuse as if you are writing a node module, since it’s viewless JS, and is essentially compatible with NPM modules anyway.
Anyway my question is, how do y’all cool folks feel about require-as-directory?