49 lines
943 B
TypeScript
49 lines
943 B
TypeScript
import { defineConfig } from 'vite'
|
|
import path from 'node:path'
|
|
|
|
export default defineConfig({
|
|
base: '/public/',
|
|
publicDir: false,
|
|
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, 'src'),
|
|
},
|
|
},
|
|
|
|
build: {
|
|
outDir: 'public',
|
|
emptyOutDir: false,
|
|
cssCodeSplit: false,
|
|
|
|
rollupOptions: {
|
|
input: {
|
|
app: path.resolve(__dirname, 'src/index.ts'),
|
|
style: path.resolve(__dirname, 'src/index.css'),
|
|
},
|
|
output: {
|
|
entryFileNames: 'index.js',
|
|
assetFileNames: (assetInfo) => {
|
|
const name = assetInfo.name ?? ''
|
|
|
|
if (name.endsWith('.css')) {
|
|
return 'index.css'
|
|
}
|
|
|
|
if (/\.(woff|woff2|eot|ttf|otf)$/i.test(name)) {
|
|
return 'fonts/[name][extname]'
|
|
}
|
|
|
|
return '[name][extname]'
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 3000,
|
|
allowedHosts: true,
|
|
},
|
|
})
|