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

Provide a browser-only export #17

Merged
merged 6 commits into from Sep 24, 2020

Conversation

marcelgerber
Copy link
Contributor

Fixes #16.

This splits up the code into filenamify.js and filenamify-path.js, where index.js imports both and provides the export as it is today, so this should not be a breaking change.

The user can now also import just filenamify/filenamify (can think about a better name maybe) to only get the browser-ready implementation that doesn't rely on Node's path.

Nothing has changed code-wise, I've just moved things around.

package.json Outdated
"exports": {
".": "./index.js",
"./filenamify": "./filenamify.js",
"./filenamify-path": "./filenamify-path.js"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not what we discussed in the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure what you mean here, but if you meant that you don't want to provide the filenamify-path export then I've just pushed a commit that removes it.

I've also changed the name of the filenamify export to browser, as suggested by you in the issue. Again, it's always easy to change it.

And if there's anything else you want changed, please feel free to tell me and I'll change it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's what I meant. Sorry if that was not clear.

@sindresorhus
Copy link
Owner

sindresorhus commented Sep 23, 2020

Can you just mention the browser sub-export using a sentence in the readme? I don't think anyone would discover otherwise.

@marcelgerber
Copy link
Contributor Author

Just added that note 👍

@sindresorhus
Copy link
Owner

One last thing, you need to update the files property in package.json.

@marcelgerber
Copy link
Contributor Author

Ah, sorry about that. I've never actually published a npm package myself, so I didn't know exactly what that property was for (or how to test if everything works properly!)

@sindresorhus
Copy link
Owner

(or how to test if everything works properly!)

sindresorhus/np#456 will help with this when merged. And sindresorhus/np#82 even more so.

@sindresorhus sindresorhus merged commit d8795d3 into sindresorhus:master Sep 24, 2020
@marcelgerber marcelgerber deleted the browser-only-export branch September 24, 2020 09:44
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

Successfully merging this pull request may close these issues.

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