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

named imports under v8 #363

Closed
perrin4869 opened this issue Dec 14, 2022 · 3 comments
Closed

named imports under v8 #363

perrin4869 opened this issue Dec 14, 2022 · 3 comments

Comments

@perrin4869
Copy link

Hi, I've been using this lib importing stringify and parse by name, import { stringify, parse } from 'query-string' under v7, but on v8 this is not possible anymore. On v7 this worked thanks to static parsing of the commonjs module.
I tried to add support for this to send a PR, but the linter doesn't like that there are both named exports and default exports with stringify and parse properties, so this would mean a huge refactor.
Was wondering if you intend to support this, or if this usage is deprecated?
Thanks!

@sindresorhus
Copy link
Owner

I don't intend to support this. I don't like named exports when the named imports have too generic names. parse could be anything. If I were to support named export, I would rename all the exports, and I don't want to make such a big breaking change and I also don't have time to decide on new names. I'm using ESM exports to create the default export, so tree shaking should still work even when it's a default export.

@sindresorhus sindresorhus closed this as not planned Won't fix, can't repro, duplicate, stale Dec 14, 2022
@perrin4869
Copy link
Author

perrin4869 commented Dec 14, 2022

Well, they have generic names but they are imported from query-string so it is not ambiguous at all what they are used for. An end-user can rename if they choose or they can import * from "query-string"...

@sindresorhus
Copy link
Owner

In large files, the import can be far away from where it's actually used. A user could indeed rename, but it's not a good API design to force the user to rename to a better name themselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants