Closed aminya closed 5 months ago
Do you need this for content security policies?
I misunderstood the issue originally.
@aminya You can expect astro/vite to inline assets smaller than 4kB if the page directly references them. In this case, the files you are showing come from framework components. They are requested only when the client directive (visible, load, idle) says they are needed, they are never requested immediately.
Closing as this would be expected behavior. Feel free to re-open if you think that is not the case.
I expect the scripts to be inlined if they are smaller than 4 KB regardless. For example, in the load
mode, the scripts should be available immediately. @lilnasy
You are right, the load directive means that the component could be included directly. However, it still follows the same architecture as the other directives - it is dynamically imported using its external url.
Yeah, so maybe the change here should be to normally import Scripts whenever load
is used.
Yes, that is a potential future. It currently does not work that way and code-wise, it would be messy to make an exception for load.
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I am using
Solidjs
for my client-side scripts, butAstro
doesn't respect myassetInlineLimit
size, and it creates separate JavaScript files in thedist/_astro
folderWhat's the expected result?
Astro should inline scripts smaller than 4KB https://vitejs.dev/config/build-options.html#build-assetsinlinelimit
Link to Minimal Reproducible Example
https://stackblitz.com/github/withastro/astro/tree/latest/examples/framework-solid?file=dist%2F_astro%2FCounter.CL2edFNV.js
The default Solid-js template has this issue. Just run
pnpm build
Participation