Skip to content
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: bundling compatibility with webpack@5 #2519

Merged
merged 2 commits into from
Jun 20, 2023
Merged

fix: bundling compatibility with webpack@5 #2519

merged 2 commits into from
Jun 20, 2023

Commits on Jun 4, 2023

  1. fix: bundling compatibility with webpack@5

    when using webpack v5 to bundle code that calls `require('sinon')` (cjs) , it would have defaulted to "exports->require" and fail with multiple node-api requirements (util, timers, etc.)
    
    this patch ensures that anyone who bundles sinon for browser gets the (browser-compatible) esm version.
    
    tested on both webpack v5 and v4. should be noted that v4 worked even without this patch, as it automatically injected polyfills.  v5 no longer does so. with this PR, people using webpack@4 to bundle sinon at least see size improvement, as the polyfills are no longer required.
    AviVahl committed Jun 4, 2023
    Configuration menu
    Copy the full SHA
    564921a View commit details
    Browse the repository at this point in the history
  2. fix: revert change for package.json -> "browser"

    browserify doesn't seem to like esm. leave that entry point alone, and ensure "exports" -> "browser" (which webpack@5 uses) is esm.
    AviVahl committed Jun 4, 2023
    Configuration menu
    Copy the full SHA
    6e3f36e View commit details
    Browse the repository at this point in the history