Astro assets can not be loaded with `rollupOptions.output.assetFileNames`

Hi, I'm migrating an Astro project from Cloudflare Pages to Cloudflare Workers using the @astrojs/cloudflare adapter. ( So it is SSR. ) After switching to Workers, I found that none of the assets are loading properly. In my astro.config.mjs, I’ve set a custom asset file naming like this:
.js
// astro.config.js
vite: {
build: {
rollupOptions: {
output: {
assetFileNames: 'assets/[ext]/[hash][extname]',
},
},
},
},
.js
// astro.config.js
vite: {
build: {
rollupOptions: {
output: {
assetFileNames: 'assets/[ext]/[hash][extname]',
},
},
},
},
This configuration worked fine on Cloudflare Pages. But with Workers, all the built assets are being placed inside the _worker.js folder under .output/. Here’s a minimal reproduction on StackBlitz. But it isn't working on StackBlitz, so I deployed on Cloudflare Workers. Is there anything I should configure differently to get assets to load properly with the Workers adapter? Thanks in advance!
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?