How do I get vite to build entire project instead of just the index.html page?

Viewed 1277

I am new to vite and I can't figure out how to get it to build my entire project instead of just my index.html page. I run "npm run build" and every time it just does that index.html but in npm run dev it works fine. I have all my files on the same level as in the picture. How do I resolve this problem?

enter image description here

1 Answers

Create a vite.config.js file at the root of project and put this in it

const { defineConfig } = require('vite')

module.exports = defineConfig({
  build: {
    rollupOptions: {
      input: {
        main: './index.html',
        about: './about.html',
        shaderOne: './shaderOne.html',
        // ...
        // List all files you want in your build
      }
    }
  }
})

If not, you will need to install vite locally. You can install it using npm install vite
See this documentation

Related