forked from okfde/froide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
71 lines (68 loc) · 2.25 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { resolve } from 'path'
import { defineConfig } from 'vite'
import autoprefixer from 'autoprefixer'
import devManifest from 'vite-plugin-dev-manifest'
import vue from '@vitejs/plugin-vue2'
const outputDir = resolve(__dirname, 'build')
// https://vitejs.dev/config/
export default defineConfig({
base: '/static/',
resolve: {
dedupe: ['bootstrap', 'vue', 'pdfjs-dist'],
extensions: ['.mjs', '.js', '.ts', '.vue', '.json']
},
build: {
manifest: true,
emptyOutDir: true,
outDir: outputDir,
sourcemap: true,
rollupOptions: {
input: {
document: './frontend/javascript/document.js',
docupload: './frontend/javascript/docupload.js',
fileuploader: './frontend/javascript/fileuploader.js',
filingcabinet:
'node_modules/@okfde/filingcabinet/frontend/javascript/filingcabinet.js',
geomatch: './frontend/javascript/geomatch.js',
main: './frontend/javascript/main.ts',
makerequest: './frontend/javascript/makerequest.js',
messageredaction: './frontend/javascript/messageredaction.js',
moderation: './frontend/javascript/moderation.js',
publicbody: './frontend/javascript/publicbody.js',
publicbodyupload: './frontend/javascript/publicbodyupload.js',
redact: './frontend/javascript/redact.js',
request: './frontend/javascript/request.ts',
tagautocomplete: './frontend/javascript/tagautocomplete.ts'
},
output: {
sourcemap: true,
entryFileNames: '[name].js',
chunkFileNames: 'js/[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]'
}
}
}
},
server: {
port: 5173,
origin: 'http://127.0.0.1:5173',
fs: { allow: ['..'] }
},
plugins: [vue(), devManifest()],
css: {
postcss: {
plugins: [autoprefixer]
}
}
})