-
Notifications
You must be signed in to change notification settings - Fork 852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(api): esnext export condition is more specific than module #5458
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5458 +/- ##
=======================================
Coverage 94.80% 94.80%
=======================================
Files 309 309
Lines 7989 7989
Branches 1683 1683
=======================================
Hits 7574 7574
Misses 415 415 |
@cjpearson Interestingly we were (separately) discussing dropping the Can you show a repro, or at least your full rollup config? I'm not very familiar with the config settings involved in the various bundlers here. Also, I'm curious what about the |
I wanted to use the esnext build to get the newer compilation target, since rollup also complains about the global I'm not actually using rollup directly, but rather through nuxt. I'll try and create a simple reproduction though. |
I've created an example here: https://github.com/cjpearson/nuxt-otel-repro Nuxt uses several plugins, so it's probably possible to narrow it down further if needed. But this app adds a single endpoint which imports When building, rollup logs a bunch of warnings:
|
Which problem is this PR solving?
I'm building an application with rollup. I want to use the
esnext
export from@opentelemetry/api
, so I add'esnext'
as an export condition. However, since the'module'
condition is always used and in the package.json it occurs before the esnext condition, the module condition will always match.Since the esnext condition is more specific, I think it makes sense to have it occur before the module condition.
https://nodejs.org/api/packages.html#packages_conditional_exports
Short description of the changes
Move esnext export condition to the top in package.json, so that an esnext + module condition will resolve to the esnext directory.
Before
exportConditions: ['module', 'esnext']
=>esm
exportConditions: ['module']
=>esm
After
exportConditions: ['module', 'esnext']
=>esnext
exportConditions: ['module']
=>esm
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist: