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

Add the possibility to use filenamify with webpack 5, without adding a path polyfill #16

Closed
marcelgerber opened this issue Sep 9, 2020 · 4 comments · Fixed by #17
Closed

Comments

@marcelgerber
Copy link
Contributor

Hey, thanks for this tool!

Since we're currently updating our repo to webpack 5 (which is soon to be released), and webpack 5 drops automatic Node polyfills, we would like to still be able to use filenamify but don't necessarily want to include a path polyfill just for that.

Would it be possible for you to enable the usage of filenamify without requiring path?

@sindresorhus
Copy link
Owner

Sorry, I have no intention of providing polyfills in my Node.js packages. This is Webpack's problem. They chose to drop automatic polyfills. Node.js users shouldn't have to be punished with a lot more dependencies because of this.

I would recommend voicing your concern over at https://github.com/webpack/webpack

@marcelgerber
Copy link
Contributor Author

Ah, sorry, there has been a slight misunderstanding here and I should've voiced my request more clearly.

We only need the filenamify method, not filenamify.path, and from what I can tell the former doesn't depend on path at all. So what I'm requesting is basically to split those two up in some way, so you can only import one and not the other and thus don't need path.

I'm not asking you to include a path polyfill in this library, and agree that this would be the wrong place to put it.

@sindresorhus
Copy link
Owner

We could maybe split the file into two files, in index.js, import both, and add a subpath export file called browser or something that exports only the main method: https://nodejs.org/api/esm.html#esm_subpath_exports

@marcelgerber
Copy link
Contributor Author

Yes, that sounds exactly like what I had in mind.
Thank you for considering this.

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

Successfully merging a pull request may close this issue.

2 participants