You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
doc: history shows wrong version for conditional package export support #36162
Under the "history" section, the docs say that conditional export support was added and also unflagged in 12.16, which doesn't seem to be the case. 12.17.0 appears to be the first version that supports conditional exports and I can't get either conditional exports or the --experimental-conditional-exports flag to work in 12.16.0.
I would like to work on this issue and
submit a pull request.
Conditional exports were added in #29978 and the flag was removed in #31001. It looks like that both PRs were indeed backported to v12.16.0. Maybe are you using another feature that was not backported until v12.17.0? Can you share a repro code that shows the feature is missing?
This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open.
I've created a reproduction here https://github.com/gpoole/node-missing-export-map. While I was doing that I think I realised the problem is actually that the conditional exports do work in 12.16, but only if the --experimental-modules option is set. So the output I get from the sample is:
12.16 with node index.js: missing map hello
12.17 with node index.js: common hello
12.16 with node --experimental-modules index.js: common hello
It seems that conditional exports are tied to module support. I think this makes sense, but I think the history section doesn't make it clear and to me it says that 12.16 uses conditional exports without any flags, which it doesn't.
Thanks for the clarification, it's probably worth clarifying the documentation indeed. Do you see the same bahavior for package self-reference in Node.js v12.16.0?
Activity
aduh95 commentedon Nov 18, 2020
Conditional exports were added in #29978 and the flag was removed in #31001. It looks like that both PRs were indeed backported to v12.16.0. Maybe are you using another feature that was not backported until v12.17.0? Can you share a repro code that shows the feature is missing?
github-actions commentedon Dec 23, 2020
This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open.
gpoole commentedon Dec 23, 2020
I've created a reproduction here https://github.com/gpoole/node-missing-export-map. While I was doing that I think I realised the problem is actually that the conditional exports do work in 12.16, but only if the
--experimental-modulesoption is set. So the output I get from the sample is:12.16 with
node index.js:missing map hello12.17 with
node index.js:common hello12.16 with
node --experimental-modules index.js:common helloIt seems that conditional exports are tied to module support. I think this makes sense, but I think the history section doesn't make it clear and to me it says that 12.16 uses conditional exports without any flags, which it doesn't.
aduh95 commentedon Mar 21, 2021
Thanks for the clarification, it's probably worth clarifying the documentation indeed. Do you see the same bahavior for package self-reference in Node.js v12.16.0?
gpoole commentedon Mar 22, 2021
Yes, I see the same behaviour. After adding
reference.cjsto the inner package I see the following:doc: expand history for conditional exports changes in v12
doc: expand history for conditional exports changes in v12
doc: expand history for conditional exports changes in v12
doc: expand history for conditional exports changes in v12
doc: expand history for conditional exports changes in v12
doc: expand history for conditional exports changes in v12
doc: expand history for conditional exports changes in v12
doc: expand history for conditional exports changes in v12
doc: expand history for conditional exports changes in v12
doc: expand history for conditional exports changes in v12