I am new to vite, to start with, I don't actually know what kind of structure I need.
I need to build multiple apps but some of them depend on the same components.
It worked well by far however I think mixed something
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
<script type="module" crossorigin src="/assets/modules/modules\\VPlayerList\\index-74e8dd8e.js"></script>
<link rel="modulepreload" crossorigin href="/assets/js/main-a0df4ea4.js">
<link rel="stylesheet" href="/assets/main.44382b18.css">
</head>
<body>
<div id="app"></div>
</body>
</html>
Hrefs are wrong, what am I missing?
forgot to attach vite config:
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import path, { resolve } from 'path'
import glob from 'glob';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), vueJsx()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
build: {
rollupOptions: {
input: Object.fromEntries(
glob.sync("src/modules/**/*.html").map((file:string) => [
path.relative(
"src",
file.slice(0, file.length - path.extname(file).length)
),
fileURLToPath(new URL(file, import.meta.url)),
])
),
output: {
chunkFileNames: 'assets/js/[name]-[hash].js',
entryFileNames: 'assets/modules/[name]-[hash].js',
dir: "dist"
}
},
},
})