Open jfirebaugh opened 2 years ago
Why not just make use of process.chdir?
It would change the execution environment of the code that the runner is running, which may be expecting the current directory to be the one where the command was executed.
Yes, but is that not the intention of a --cwd
flag? For example, running ts-node --cwd /some/where your-script.ts
will try to execute /some/where/your-script.ts
. I'm just saying, cwd
as flag is confusing if the actual goal is to just tell esbuild-runner to read from another package.json.
I want to use esbuild-runner in contexts where the current directory is not the directory containing the package.json whose dependencies should be used to chose externals. This makes the location for package.json configurable. It's roughly equivalent to the
cwd
option from ts-node: https://github.com/TypeStrong/ts-node/blob/abc616ece2a8cdb066439a4e5c6fc7d493aa4612/src/index.ts#L191-L196.