Replies: 2 comments 1 reply
-
const fs = require(`fs`);
const path = require(`path`);
const os = require(`os`);
const root = path.dirname(__dirname);
// Makes it possible to access our dependencies
const pnpFile = `${__dirname}/../../../../../.pnp.cjs`;
if (fs.existsSync(pnpFile))
require(pnpFile).setup();
const tsconfig = `${__dirname}/../tsconfig.json`;
process.env.TS_NODE_FILES = true
process.env.TS_NODE_TRANSPILE_ONLY = true
process.env.TS_NODE_COMPILER_OPTIONS = '{\"importHelpers\": false}'
process.env.TS_NODE_PROJECT = tsconfig
// process.env.TS_NODE_TRANSPILER = require('ts-node/transpilers/swc-experimental'). // <!---- WOULD LOVE THIS
process.env.MNT_VERBOSITY='1'
process.env.FORCE_COLOR=1
require(`ts-node`).register();
module.exports = require(`./bin/mnt`); |
Beta Was this translation helpful? Give feedback.
-
In general, I don't plan to add environment variables for all ts-node options. The recommended approach is to use a tsconfig file that fully configures ts-node, with as many options as you may want to use. ts-node's environment variables predate the ability to specify configuration in tsconfig. You can choose this tsconfig using
If you really, really need a way to specify additional ts-node options via environment variable, you can send us a pull request implementing #1204. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm creating a ts-node script to run my application and would like to boost it to use SWC. The script uses environment variables to pass options onto ts-node
The swc/transpiler options don't seem to allow this. Is it possible this way?
I guess using the tsconfig setting method would be best "workaround" otherwise?
Beta Was this translation helpful? Give feedback.
All reactions