diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/env.h | 1 | ||||
-rw-r--r-- | src/module_wrap.cc | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/env.h b/src/env.h index b3f1243f775..8cd56b4dd66 100644 --- a/src/env.h +++ b/src/env.h @@ -255,6 +255,7 @@ constexpr size_t kFsStatsBufferLength = V(hostmaster_string, "hostmaster") \ V(http_1_1_string, "http/1.1") \ V(ignore_string, "ignore") \ + V(import_string, "import") \ V(infoaccess_string, "infoAccess") \ V(inherit_string, "inherit") \ V(input_string, "input") \ diff --git a/src/module_wrap.cc b/src/module_wrap.cc index 2fa8ba498ed..568e1ad2fdb 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -967,6 +967,17 @@ Maybe<URL> ResolveExportsTarget(Environment* env, return resolved; } } + if (env->options()->experimental_conditional_exports && + target_obj->HasOwnProperty(context, env->import_string()).FromJust()) { + matched = true; + conditionalTarget = + target_obj->Get(context, env->import_string()).ToLocalChecked(); + Maybe<URL> resolved = ResolveExportsTarget(env, pjson_url, + conditionalTarget, subpath, pkg_subpath, base, false); + if (!resolved.IsNothing()) { + return resolved; + } + } if (target_obj->HasOwnProperty(context, env->default_string()).FromJust()) { matched = true; conditionalTarget = |