Set Vite to compile for subfolder deploy

Posted on November 6, 2023

If you need to deploy your Vue or React project on a sub-folder, you need to add a little configuration option in your Vite config file:

export default defineConfig({
  base:'./',
});

The above config makes relative the app dependencies in the HTML file, thus, it's going to work on server in sub folder.