esbuild-dev icon indicating copy to clipboard operation
esbuild-dev copied to clipboard

[RFC]: Pass Node Options in Command Line

Open hyrious opened this issue 3 years ago • 1 comments

Similar to #10 , options like --experimental-loader --experimental-json-modules are very useful too. But I have no space to place them.

hyrious avatar Nov 02 '21 01:11 hyrious

Reading ts-node, it seems node options can be passed via NODE_OPTIONS= env.

hyrious avatar Nov 02 '21 02:11 hyrious

Sadly not all options can, though I've only had the issue with a very modern one:

NODE_OPTIONS='--env-file=.env' esbuild-dev --watch

node: --env-file= is not allowed in NODE_OPTIONS

Sheraff avatar Dec 07 '23 15:12 Sheraff

Maybe we need an option like --node:--env-file=.env? The syntax is because I only have the same arg parser as esbuild, this new flag can be defined as ["node", list].

There may be a better naming, though.

hyrious avatar Dec 07 '23 15:12 hyrious

This option shall works now:

$ esbuild-dev test/index.ts
undefined

$ esbuild-dev --node:--env-file=test/.env test/index.ts
hello

hyrious avatar Dec 08 '23 03:12 hyrious