2 ms·
If I were designing import in JS I'd give option to inject dependency into imported module that overrides the one that language would normally load from file.
by scotty79 11y ago
If I were designing import in JS I'd give option to inject dependency into imported module that overrides the one that language would normally load from file.
Like this:
// model.js:
var db = require("db");
// controller.js:
var model = require("model");
// test.js:
var model = require("model", { db: require("db_mock") });
I could probably implement something like that as webpack plugin.