-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.prod.js
More file actions
55 lines (49 loc) · 1.2 KB
/
vite.config.prod.js
File metadata and controls
55 lines (49 loc) · 1.2 KB
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
import { defineConfig } from 'vite'
import path from 'path'
import babel from 'vite-plugin-babel'
import { analyzer } from 'vite-bundle-analyzer'
/**
* Конфигурация для сборки библиотеки в продакшн.
* Сборка библиотеки выполняется в dist.
*/
export default defineConfig({
base: './',
build: {
target: 'es2015',
sourcemap: false,
lib: {
entry: {
main: path.resolve(__dirname, 'src/main.ts')
},
name: 'ImageEditor',
formats: ['es'],
fileName: (format, entryName) => `${entryName}.js`
},
rollupOptions: {
// внешние зависимости – не бандлить их
external: ['fabric', 'jspdf', 'jsondiffpatch', 'diff-match-patch']
},
outDir: 'dist',
emptyOutDir: true
},
plugins: [
babel({
babelConfig: {
babelrc: false,
configFile: false,
presets: [
['@babel/preset-env', {
modules: false,
targets: { esmodules: true }
}]
]
}
}),
analyzer({
open: true,
gzipSize: true,
brotliSize: true,
defaultSizes: 'parsed'
})
]
})