Closed SGAKonata closed 2 months ago
Try this renderBuiltUrl
API → https://vitejs.dev/guide/build.html#advanced-base-options
Thanks a lot. Althought it's still experimental, but it wroks! Here is my code
// vite.config.ts
// defineConfig
experimental: {
renderBuiltUrl(filename, { hostId, hostType, type }) {
if (hostType === 'html') {
const name = hostId.replace(/\.html$/, '')
return base + name + '/' + filename
} else {
return base + filename
}
},
},
For each page in my project may be deployed with different endpoints, so my index should use different base url to get their static resource.
For example, I have two apps
apple
andbanana
, and two html after build:They are deployed with address
http://server/apple
andhttp://server/banana
seperately. To get access to their static files, they need to vistserver/{name}/static
, and this is usually config invite.config.ts -> base
but it's a global setting.Is it possble to achieve my aim thought this plugin?