Skip to content

unplugin support for # in paths#1867

Merged
edemaine merged 1 commit intomainfrom
unplugin-hash
Mar 26, 2026
Merged

unplugin support for # in paths#1867
edemaine merged 1 commit intomainfrom
unplugin-hash

Conversation

@edemaine
Copy link
Copy Markdown
Collaborator

It was mentioned on Discord that the unplugin doesn't work when a directory (or filename) has a # character in it, at least with Webpack.

This PR should fix that, while still supporting # as a special suffix character as used in some systems, via a simple heuristic: if the file exists before stripping a # suffix, then don't strip it. (By contrast, we currently strip all # suffixes.)

I tested in integration/unplugin-examples/webpack by changing module.civet to mod#ule.civet (not committed here). Webpack has a second issue (maybe eventually fixed in unjs/unplugin#592) that # in paths are encoded as \0#. Looking for this as opposed to raw # would be another way to fix this issue, but it'd be specific to Webpack, and it's arguably a bug in unplugin, so I'd rather not rely on it.

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@edemaine edemaine merged commit f0fc560 into main Mar 26, 2026
3 of 4 checks passed
@edemaine edemaine deleted the unplugin-hash branch March 26, 2026 13:57
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.

2 participants