#Simplest way to specify a 'base URL' for static/public assets on RR7?

1 messages · Page 1 of 1 (latest)

obsidian siren
#

Hi 👋,

For various reasons I'm aiming to host my /assets/* and the stuff from /public/* at the root on a separate domain (say static.example.com). Is there an easy way to specify that the prod build should prefix all references to these with the appropriate base URL?

Thanks!

hardy pilot
#

we just use an environment variable that we set at build time during CI, and then read that in the vite config to set the base option:

export default defineConfig({
  base: process.env['PUBLIC_PATH'],
  // ...
});