When to bundle:
When not to bundle:
By "callable script" in the above lists, I mean something that's exported via the "bin" field in the project's package.json and which is installable via npm link or npm i -g.
execSync in realtimeBy default, execSync only shows its work when it's done. But you can encourage it to display updates in realtime like this:
import { execSync } from "node:child_process"
execSync(`...`, { stdio: "inherit" })
In package.json:
{
"imports": {
"#root/*": "./*",
"#foo/*": "./path/to/foo/*",
"#bar/*": "./some/other/path/to/bar/*"
}
}
Then in some deep file:
import { something } from "#root/some/path"