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

Fix hbs plugin not resolving .hbs due to broken Regex #2151

Merged
merged 1 commit into from
Oct 9, 2024
Merged

Conversation

simonihmig
Copy link
Collaborator

@simonihmig simonihmig commented Oct 9, 2024

The Regex in syntheticJStoHBS was broken, introduced in #2121. /cc @patricklx

Given a single .hbs file (TO) such as components/json/index.hbs, the hbs rollup would need to resolve that from a module id of components/json/index.js to the actual components/json/index.hbs file on disk. But with the broken regex, it would instead try to resolve to components.hbson/index.js!

Added some unit tests (that failed without the fix) to prevent regressions.

🚨 Note that the same bug exists on main already, given that #1855 was done before backporting to stable! So maybe #2144 should also include this and the other recent changes on stable? /cc @mansona

The Regex in `syntheticJStoHBS` was broken.

Given a TO .hbs such as `components/json/index.hbs`, the hbs rollup would need to resolve that from a module id of `components/json/index.js` to the actual `components/json/index.hbs` file on disk. But with the broken regex, it tried instead to find `components.hbson/index.hbs`!

Added some unit tests (that failed without the fix) to prevent regressions.
const testCases = [
['foo.js', 'foo.hbs'],
['foo.js?qp', 'foo.hbs?qp'],
['foo/json.js', 'foo/json.hbs'],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the case that failed before:
image

@simonihmig simonihmig added the bug Something isn't working label Oct 9, 2024
@simonihmig simonihmig requested a review from a team October 9, 2024 17:25
@ef4 ef4 merged commit 1a2431e into stable Oct 9, 2024
223 checks passed
@ef4 ef4 deleted the fix-hbs-plugin branch October 9, 2024 19:31
@github-actions github-actions bot mentioned this pull request Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants