Closed farnabaz closed 2 weeks ago
Thanks for nice reproduction.
We have implemented performance now and it is available in nightly channel and will be fore unenv v2 / nitro v3 / nuxt v4.
In the meantime i would suggest to manually add a polyfill to the apps.
Unfortunately, I can't use unenv-nightly
because of structure change in dist directory regarding the internals.
In the meantime i would suggest to manually add a polyfill to the apps.
How can I add polyfill manually to mock the perf_hooks
imports?
structure change in dist directory regarding the internals.
Which files are breaking your project? If minor, we might add it for backward compatibility so you can leverage v2.
How can I add polyfill manually to mock the perf_hooks imports?
Configure unenv: { polyfills: {}}
in nuxt/nito config and add something like this.
Seems that these files are moved inside http/internal/
directory.
Ah this is from h3... https://github.com/unjs/h3/pull/781 should fix in h3/nuxt nightly channel. Please let me know if other conflicts happening.
Environment
Reproduction
Repo: https://github.com/farnabaz/unenv-performance-now Demo: https://nuxt-ot.nuxt.dev
Describe the bug
Some packages like
@opentelemetry/core
importsperformance
directly fromperf_hooks
and thus this import handles by unenv in non-node environments. The issue is that performance polyfill is not yet implemented (or at leastperformance.now
is not implemented) and callingperformance.now()
return proxy function.As the result, we get this error
Additional context
No response
Logs
No response