svitejs / node-conditions

MIT License
9 stars 0 forks source link

import, require, types and module conditions #10

Closed dominikg closed 1 year ago

dominikg commented 1 year ago

Describe the problem

Currently some conditions are not available due to their special nature.

import,require

import {IMPORT,REQUIRE} from 'node-condtions' doesn't make much sense, or does it?

types

Used by typescript, is that useful at all for applications importing flags or could it be useful in tooling? Either way, the way tests are currently run it would load our own index.d.ts instead of the conditions so extra care when adding.

module

this is a special condition appearantly used by typescript and esbuild (wtf) see https://github.com/evanw/esbuild/issues/2417

figure out why this exists over import and only support if it makes sense to have it queried

Describe the proposed solution

investigate and add what's sensible

Alternatives considered

leave them out

Importance

nice to have

benmccann commented 1 year ago

figure out why this exists over import and only support if it makes sense to have it queried

I went down the rabbit hole on this one not too long ago. There's an explanation of why it exists here: https://github.com/microsoft/tslib/issues/183#issuecomment-1279411988