sindresorhus / filenamify

Convert a string to a valid safe filename

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

marcelgerber opened this issue · comments

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?

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

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.

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

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