Skip to content

bundling issues with webpack #1992

Closed
Closed

Description

@vetruvet

Currently package.json specifies >=12.18 in engines.node, but the code uses ??= and util/types which are Node.js 15+ features.

The implementation should look like...

Updating package.json to reflect the correct minimum Node.js version.

I have also considered...

Alternatively, the code could stop using those features to retain compatibility with 12.18+

Activity

  1. added
    enhancement
    on Mar 6, 2023
  2. mcollina commented on Mar 7, 2023

    @mcollina
    SponsorMember

    Could you tell us more about the compatibility issues you are facing? Our test suite (minus fetch, which is 16+) pass on node v12: https://github.com/nodejs/undici/actions/runs/4331585584.

  3. vetruvet commented on Mar 7, 2023

    @vetruvet
    Author

    I guess the issue is when the library is bundled (e.g. by webpack), it causes code that's conditionally required only on certain Node versions to be included in the resulting code bundle, and there are instances of nullish coalesce assignmen t (??=) syntax in those parts (specifically lib/fetch/headers.js, lib/cookies/parse.js, and lib/websocket/receiver.js).

    Without bundling those are only required on Node 16+ but when bundled, it causes parsing errors even though those features aren't used.

    I've worked around it so far by configuring Babel to parse&transform this library. Perhaps at least a warning about using this library with bundlers in the docs would be helpful.

  4. ronag commented on Mar 7, 2023

    @ronag
    Member

    We could also not use ??= ... PR welcome

  5. KhafraDev commented on Mar 8, 2023

    @KhafraDev
    Member

    we've had regressions so I'd rather not accept a PR unless tests are included

  6. changed the title [-]Request: bump minimum Node.js version in package.json[/-] [+]bundling issues with webpack[/+] on Mar 18, 2023
  7. trivikr commented on May 3, 2026

    @trivikr
    Member

    Closing as the issues raised in this were with node 12 in undici 4.x, and all undici versions <7.x have been end-of-life at the time of writing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions