-
Notifications
You must be signed in to change notification settings - Fork 137
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 deps: correctly handle addon templates and addon app files 2 #2078
Conversation
patricklx
commented
Aug 24, 2024
•
edited
Loading
edited
- makes external templates ignored
- optimised templates do not get a pairing
- hbs extension search during bundle
- externalize app files during bundling
- since the request comes from a dep file we cannot know the original addon file. Which is why the from file will be encoded into the specifier.
- This is required because the resolution can change during development
- stage2 tests now correctly uses optmized deps
@ef4 this fixes some esbuild issues . |
85ae734
to
d8075ba
Compare
fb4d5e8
to
ff31ffa
Compare
packages/vite/src/esbuild-request.ts
Outdated
embroider: { | ||
enableCustomResolver: false, | ||
meta: request.meta, | ||
const extensions = ['', '.hbs']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ef4 I tried to move the extension resolving here to defaultResolve, but it does not work.
I think the issue is that when we resolve files in addons, we do use a relative specifier with a from file in the rewritten-addons. What esbuild then sees is something like
{
type: 'ignored',
result: {
external: true,
path: './components/hello-world'
}
}
so it has relative path as the externalized ID, I think this will confuse the system between esbuild and vite
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did the same changes in #1876 and there it works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could do this as an intermediate step? I would change the tests to do the checks at runtime
c094982
to
bc8ae0f
Compare
Thanks for working on the stage2 tests here, I actually tried to use your version in #2093 but realized there was just so much irrelevant stuff lurking in that test suite that it needed rewriting anyway, and I was able to drop a lot of it. |
369538d
to
b330a0e
Compare
I would suggest merging master and adding tests to the vite-internals tests, which I have now expanded so they run against |
2b2cf1d
to
94170f4
Compare
94170f4
to
bd1235b
Compare
this looks like its fixed, closing |