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

vite: fix hbs loading for virtual pair components #1813

Merged
merged 8 commits into from
Mar 21, 2024

Conversation

patricklx
Copy link
Contributor

@patricklx patricklx commented Feb 22, 2024

it happens when embroider generates a virtual pair component, the resolved id then looks like /template.hbs/component.ts-embroider-pair-component

@mansona
Copy link
Member

mansona commented Feb 22, 2024

This is likely going to be solved as part of #1794, we literally just hit a similar error

@patricklx
Copy link
Contributor Author

@mansona i think that will fix a specific issue. But not the filter. I think the filter is not good.
It would also match any extension like .hbs.md

@patricklx patricklx force-pushed the fix-hbs-filter branch 3 times, most recently from 1e33bc3 to 59b42eb Compare February 29, 2024 15:24
@patricklx
Copy link
Contributor Author

patricklx commented Mar 12, 2024

first error https://github.com/embroider-build/embroider/actions/runs/8252373750/job/22571786702?pr=1813#step:4:259
Failed to resolve import "../template.hbs?v=45cfc9c0" from "embroider_virtual:/tmp/tmp-2031TzNurs5PI17V/node_modules/.embroider/rewritten-app/components/old/template.hbs?v=45cfc9c0/..%2Fcomponent.js%3Fv%3D45cfc9c0-embroider-pair-component". Does the file exist?

second:
https://github.com/embroider-build/embroider/actions/runs/8252373750/job/22571786702?pr=1813#step:4:351
Could not load /tmp/tmp-2031TzNurs5PI17V/node_modules/.embroider/rewritten-app/components/old/template.js: ENOENT: no such file or directory, open '/tmp/tmp-2031TzNurs5PI17V/node_modules/.embroider/rewritten-app/components/old/template.js'

templateResolution.id = resolvedId;

const pkg = resolverLoader.resolver.packageCache.ownerOfFile(resolvedId);
const isInComponents = pkg?.isV2App() && resolvedId.slice(pkg?.root.length).startsWith('/components');
Copy link
Contributor Author

@patricklx patricklx Mar 19, 2024

Choose a reason for hiding this comment

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

this will always be false for addons, which is good, because they should not do template colocation / template-only.
It's already done in previous stage

@mansona mansona changed the title vite: fix hbs filter vite: fix hbs loading for virtual pair components Mar 21, 2024
Copy link
Member

@mansona mansona left a comment

Choose a reason for hiding this comment

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

This looks good 👍 myself and @ef4 reviewed it this morning and we're happy to get it merged. I added a commit to reset the hbs extension handling to use createFilter again, but tests pass and I'm happy that it's doing the same thing

@mansona mansona merged commit bac2415 into embroider-build:main Mar 21, 2024
93 checks passed
@patricklx patricklx deleted the fix-hbs-filter branch March 21, 2024 14:49
@mansona mansona added the bug Something isn't working label Apr 4, 2024
@github-actions github-actions bot mentioned this pull request Apr 4, 2024
@github-actions github-actions bot mentioned this pull request Apr 15, 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.

2 participants