is there any way to access those conditions (and the standard import/require/node conditions) as a set within a module?
is there any way of passing in custom conditions to either the import(...) call or import.meta.resolve
(2) I suspect will be no, and possibly with really good reason - the use case here would be that in some cases (e.g., testing) we import client side functionality to the server - the module in question defines a client import and no server import (mostly this is correct) - but in this specific case it would be nice to (for example) define that it's running within a test, and as such should use a test entry point. Or, "fake" that it's being imported from the browser.
Thanks!
Node.js version
18 - if it works on some other version than 18 that'd be good to know too.
Details
Our application is executed with some conditions, like so:
I have two questions:
import(...)
call orimport.meta.resolve
(2) I suspect will be no, and possibly with really good reason - the use case here would be that in some cases (e.g., testing) we import client side functionality to the server - the module in question defines a client import and no server import (mostly this is correct) - but in this specific case it would be nice to (for example) define that it's running within a test, and as such should use a test entry point. Or, "fake" that it's being imported from the browser.
Thanks!
Node.js version
Example code
No response
Operating system
n/a - but I'm on linux
Scope
runtime
Module and version
Not applicable.