-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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(manifest): include assets referenced in html #14657
Conversation
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.
Looks good to me 👍
Would you add a test here that ensures the asset only referenced in html is included in the manifest?
vite/playground/assets/__tests__/assets.spec.ts
Lines 413 to 424 in 96a4ce3
test.runIf(isBuild)('manifest', async () => { | |
const manifest = readManifest('foo') | |
const entry = manifest['index.html'] | |
for (const file of listAssets('foo')) { | |
if (file.endsWith('.css')) { | |
expect(entry.css).toContain(`assets/${file}`) | |
} else if (!file.endsWith('.js')) { | |
expect(entry.assets).toContain(`assets/${file}`) | |
} | |
} | |
}) |
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.
tiny nit: could we use an svg so it's smaller?
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.
My next PR will make SVG be inline.
But I can use a new SVG and reduce the inlineSize now, but this requires a new config test because the default one is already increase to 8kb (why I used ~12kb one)
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.
Ah ok if it's specifically to pass the 8kb limit, and there's no existing files to use I'm fine with it then. No need to change 👍
@sapphi-red you're suggesting adding a new test with a html + asset file only and duplicate this test? |
My bad, I misunderstood the test. |
Discovered by hasard while doing #14643 (required to make tests pass)