-
Notifications
You must be signed in to change notification settings - Fork 4
/
vite.config.js
46 lines (43 loc) · 1.23 KB
/
vite.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import { defineConfig } from 'vite'
// eslint-disable-next-line no-undef
const outputDir = resolve(__dirname, 'build')
// https://vitejs.dev/config/
export default defineConfig({
base: '/static/',
resolve: {
dedupe: ['vue', 'bootstrap', 'pdfjs-dist'],
extensions: ['.mjs', '.js', '.ts', '.vue', '.json']
},
build: {
manifest: true,
emptyOutDir: true,
outDir: outputDir,
sourcemap: true,
rollupOptions: {
input: {
entry: 'frontend/javascript/entry.js',
fcdownloader: 'frontend/javascript/fcdownloader.js',
},
output: {
sourcemap: true,
entryFileNames: '[name].js',
assetFileNames: (assetInfo) => {
if (assetInfo.name.endsWith('.css')) {
return 'css/[name][extname]'
} else if (
assetInfo.name.match(/(\.(woff2?|eot|ttf|otf)|font\.svg)(\?.*)?$/)
) {
return 'fonts/[name][extname]'
} else if (assetInfo.name.match(/\.(jpg|png|svg)$/)) {
return 'img/[name][extname]'
}
console.log('assetInfo', assetInfo)
return 'js/[name][extname]'
}
}
}
},
plugins: [vue()]
})