utilities icon indicating copy to clipboard operation
utilities copied to clipboard

request: add iife browser bundle to `@sapphire/stopwatch`

Open favna opened this issue 3 years ago • 0 comments

Is there an existing issue or pull request for this?

  • [X] I have searched the existing issues and pull requests

Feature description

Following #270 we can now make @sapphire/stopwatch have an IIFE bundle because we can inject the Node import for CJS and ESM dynamically with esbuild. Previously we relied on import { performance } from 'node:perf_hooks';, but this import isn't needed for browsers where the Performance API is on the global scope.

Desired solution

@sapphire/fetch to have an IIFE bundle by modifying the tsup config to dynamically add the node:perf_hooks import.

Alternatives considered

  • Not providing a browser bundle
    • We have no reason not to provide it when it's possible

Additional context

This requires #270 to be merged

favna avatar Jan 26 '22 23:01 favna