Friday, 20 August 2021

Vite.js not emitting HTML files in multi page app

I have a multi page app that I'm trying to build with Vite.js (migrating from Webpack). When building the Vite + React example code I see that it emits:

  • dist/index.html
  • dist/assets/<various assets>

However, when I try to make a multi page app as shown in the docs none of the HTMLs are emitted (but the rest of the content of /assets/ is there). Why is this?

// vite.config.js excerpt:
import { defineConfig } from 'vite'
import { dirname } from 'path';
import { fileURLToPath } from 'url';

export default defineConfig({
  root: 'client',
  build: {
    outDir: 'dist',
    rollupOptions: {
      input: {
        main: dirname(fileURLToPath(import.meta.url + 'index.html')),
        login: dirname(fileURLToPath(import.meta.url + 'login.html')),
      }
    }
  },
});


from Vite.js not emitting HTML files in multi page app

No comments:

Post a Comment