I've been playing with Vitejs, Lit-element & TailwindCSS to upgrade my skills.
Tried to deploy a website based on components.
Everything is good with the npm run dev
, my website works in the preview.
The real problem is with the npm run build
.
Even if the files are there
the preview in a browser is empty, components are not being inserted but css and js are applied(?).
My vite.config.ts
import { resolve } from 'path';
import { defineConfig } from 'vite';
// once root been changed, the outDir changes too
const outDir = resolve(__dirname, 'dist');
// https://vitejs.dev/config/
export default defineConfig({
build: {
outDir,
emptyOutDir: true,
cssCodeSplit: true,
minify: false,
lib: {
entry: './src/index.ts',
formats: ['es'],
fileName: (format) => `index.${format}.js`
},
manifest: true,
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
},
external: /^lit/
}
}
})
After loading index.html in a browser i see
I'm learning and really don't know what I'm doing and cannot find proper docs on my own, so I'm asking here.
Thank you for any help.