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

bundling issues with webpack #1992

Open
vetruvet opened this issue Mar 6, 2023 · 4 comments
Open

bundling issues with webpack #1992

vetruvet opened this issue Mar 6, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@vetruvet
Copy link

vetruvet commented Mar 6, 2023

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+

@vetruvet vetruvet added the enhancement New feature or request label Mar 6, 2023
@mcollina
Copy link
Member

mcollina commented Mar 7, 2023

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.

@vetruvet
Copy link
Author

vetruvet commented Mar 7, 2023

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.

@ronag
Copy link
Member

ronag commented Mar 7, 2023

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

@KhafraDev
Copy link
Member

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

@KhafraDev KhafraDev changed the title Request: bump minimum Node.js version in package.json bundling issues with webpack Mar 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants