diff options
author | Guy Bedford <guybedford@gmail.com> | 2019-12-05 05:14:48 +0300 |
---|---|---|
committer | Guy Bedford <guybedford@gmail.com> | 2019-12-13 01:35:08 +0300 |
commit | 357a99293e0132ed96afde56df5ce5aea2b550cd (patch) | |
tree | 49c5732ab3fe9d0b3727b1c3c688e63bb408ad41 /src/module_wrap.cc | |
parent | edf654d43e7140f6ac50aefc5dd3f0474bfc5cfe (diff) |
module: conditional exports import condition
PR-URL: https://github.com/nodejs/node/pull/30799
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'src/module_wrap.cc')
-rw-r--r-- | src/module_wrap.cc | 11 |
1 files changed, 11 insertions, 0 deletions
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 = |