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?
Asked
Active
Viewed 6,064 times
1 Answers
9
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

Arjit Tiwari
- 410
- 2
- 10
-
2I love you very much – Yerbs Mar 21 '22 at 18:13
-
I am trying to also include a css "library" and vite is telling my to `build.rollupOptions.external`. I am adding this to my config file but it seems my syntax is incorrect. What do I need to fix? build: { rollupOptions: { external: { style: './style.css', }, – Yerbs Mar 21 '22 at 19:31
-
im rebuilding the vite app nvm – Yerbs Mar 21 '22 at 20:28
-
@Yerbs Maybe you could see [this question](https://stackoverflow.com/questions/67696920/vite-rollup-failed-to-resolve-build-error) or ask another question. – Arjit Tiwari Mar 22 '22 at 08:40