ts-node icon indicating copy to clipboard operation
ts-node copied to clipboard

can we get an api to specify the esm loader.

Open wibed opened this issue 2 years ago • 1 comments

to use esm my package.json looks something like this:

{
    "start": "npm run clean && cross-env NODE_ENV=development NODE_OPTIONS=\"--loader=ts-node/esm --trace-warnings\" webpack serve --mode=development --config webpack.config.ts",
}

even though i set esm to be true in ts-config

{
  "ts-node": {
    "esm": true,
    "files": true,
    "experimentalSpecifierResolution": "node",
  },
}

i dont know why this is necessary. i know i cannot set corresponding loader in any config and had to resort to set it within NODE_OPTIONS.

new to transpilers and the world around it, this was a surprisingly painful experience.

wibed avatar Apr 23 '23 11:04 wibed

tsx might be better for this case

candidia avatar Apr 28 '23 17:04 candidia