@wolf-scope/gamifykit
Version:
UI library for web applications using Lit
57 lines (51 loc) • 1.64 kB
JavaScript
// vite.config.js
import { defineConfig } from 'vite'
import { resolve } from 'path'
import ComponentsEntryPlugin from './vite-plugins/components-entry-plugin'
import { fileURLToPath } from 'url'
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
return {
server: {
host: '0.0.0.0',
port: 3001,
strictPort: true,
},
plugins: [ComponentsEntryPlugin(mode)],
css: {
modules: {
localsConvention: 'camelCaseOnly',
generateScopedName: '[name]__[local]___[hash:base64:5]',
},
},
build: {
target: 'esnext',
outDir: 'dist',
lib: {
entry: {
index: resolve(__dirname, 'src/index.ts'),
'register-all': resolve(__dirname, 'src/register-all.ts'),
models: resolve(__dirname, 'src/models/index.ts'),
},
formats: ['es'],
fileName: (format, entryName) => {
//if it's a component, keep it's name and add the component/ prefix
const extension = format === 'es' ? 'mjs' : format
return `${entryName}.${extension}`
},
},
rollupOptions: {
// If we want to publish standalone components we don't externalize lit,
// if you are going to use lit in your own project, you can make it a dep instead.
external: /^lit/,
},
},
resolve: {
alias: {
'@': resolve(__dirname, './src'),
'@wolf-scope/wolf-common': resolve('../wolf-common/src'),
'@wolf-scope/wolf-ui': resolve('../wolf-ui/src'),
},
},
}
})