Node: conditional exports show an unexpected warning message, even though no longer behind flag

Created on 16 Feb 2020  路  8Comments  路  Source: nodejs/node

  • Version: Node v13.8.0
  • Platform: Mac OSX

What steps will reproduce the bug?

$ node --version
v13.8.0
$ npm install [email protected]
$ node -e "require('es-module-lexer')"
(node:75146) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time

How often does it reproduce? Is there a required condition?

Always on latest Node v13

What is the expected behavior?

I wouldn't expect to see any warning whatsoever.

Additional information

https://nodejs.org/api/esm.html#esm_conditional_exports

This documentation exists without any sort of experimental warning. It is not hidden behind any flag.

More confusing to users, It is a warning that is exposed by the libraries that they consume. So the user can update their dependencies (or add new ones) and start to get this warning without understanding why.

For Snowpack, we want to use this package聽that uses conditional exports, but are now worried about this warning message confusing our users.

/cc @guybedford

ES Modules question

Most helpful comment

Is it possible to see which module generated this warning (and warnings in Node.js in general)? It's pretty difficult to track down in non-trivial scenarios.

All 8 comments

The entire ECMAScript Modules implementation is experimental and is marked as such in the documentation. The fact that we removed the flag doesn't mean the API is stable yet

Just to make sure that I'm understanding correctly: Packages are able to use experimental code paths / features that will throw warnings when I run them, even if I don't specifically want that experimental behavior. Packages shouldn't be shipping conditional exports without understanding that they can cause warnings when run in Node v13.

^ Is that a correct understanding of the current state of things?

@FredKSchott yes. our final experimental stage is removing the flag but keeping the warning. I think the intention is that it be used in packages tagged with @next or something similar?

Okay, I personally disagree with that behavior but I understand the reasoning 馃憤

At the very least, then, I'd recommend making that implication/understanding more explicit in the docs, and closer to the relevant sections. Both es-module-lexer and Preact have added an export map in their latest release, and I'm not sure if this implication was understood in either case.

Closing as it seems like the question was answered

We have an ongoing discussion about warnings in https://github.com/nodejs/modules/issues/485 please feel free to chime in there if you have any specific comments about how we can improve things

Thanks Myles! Will do 馃憤

Is it possible to see which module generated this warning (and warnings in Node.js in general)? It's pretty difficult to track down in non-trivial scenarios.

Was this page helpful?
0 / 5 - 0 ratings