TL;DR
It would be awesome if jiti could support custom user conditions in its options.
Something like:
conditions
- Type: Array
- Default: -
- Environment variable: JITI_CONDITIONS
Takes a list of additional conditions to be considered during resolving.
const jiti = createJiti(import.meta.url, { conditions: ['development'] });
Motivations
Setting --conditions in Node.js is not easy when third-party tools are involved and/or when we don't control how Node.js is invoked. See point 5 at "The Problem - TL;DR" in this Node.js Proposal.
I really think jiti could make a huge difference here while the ecosystem is transitioning into a more native solution. It could allow achieving 100% ESM/TypeScript projects in a clean way, from configuration files to implementation code.
To make this new feature work with ESM, we will need to reconsider #34, so to make options effective when using ESM loader register (e.g. development tools' ESM configuration files).
.jitirc
JITI_CONDITIONS=['development']
I know the target is to go fully native (the above Node.js proposal is all about it), but there is still a lot of good jiti can do.
I would be happy to help implementing this! Hope to get some feedback.
Additional information
TL;DR
It would be awesome if jiti could support custom user conditions in its options.
Something like:
conditionsTakes a list of additional conditions to be considered during resolving.
Motivations
Setting
--conditionsin Node.js is not easy when third-party tools are involved and/or when we don't control how Node.js is invoked. See point5at "The Problem - TL;DR" in this Node.js Proposal.I really think jiti could make a huge difference here while the ecosystem is transitioning into a more native solution. It could allow achieving 100% ESM/TypeScript projects in a clean way, from configuration files to implementation code.
To make this new feature work with ESM, we will need to reconsider #34, so to make options effective when using ESM loader register (e.g. development tools' ESM configuration files).
.jitircI know the target is to go fully native (the above Node.js proposal is all about it), but there is still a lot of good jiti can do.
I would be happy to help implementing this! Hope to get some feedback.
Additional information