I built a multi-page app with Vue CLI and Vue 2 by changing vue.config.js
like below:
pages: {
index: {
entry: './src/pages/index/main.js',
template: 'public/index.html',
title: 'index page',
chunks: ['chunk-vendors', 'chunk-common', 'index']
},
admin: {
entry: './src/pages/admin/main.js',
template: 'public/index.html',
title: 'admin page',
chunks: ['chunk-vendors', 'chunk-common', 'admin']
}
},
...
But how do I build a multi-page app with Vite and Vue 3?
This is my Directory Structure.
I edited the vite.config.js like this:
import vue from '@vitejs/plugin-vue'
const { resolve } = require('path')
/**
* @type {import('vite').UserConfig}
*/
export default {
plugins: [vue()],
build:{
rollupOptions:{
input:{
main:resolve(__dirname,'index.html'),
admin:resolve(__dirname,'src/admin/index.html')
}
}
}
}
But it returns errors when i build and i counld not open the admin page by localhost:3000/admin/index.html.
question from:
https://stackoverflow.com/questions/65868976/how-to-build-a-multi-pages-application-by-vite2-and-vue3 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…