-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
108 lines (105 loc) · 2.41 KB
/
rollup.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import typescript from '@rollup/plugin-typescript'
import dts from 'rollup-plugin-dts'
import { visualizer } from 'rollup-plugin-visualizer'
import autoExternal from 'rollup-plugin-auto-external'
import postcss from 'rollup-plugin-postcss'
import cleanup from 'rollup-plugin-cleanup'
import { terser } from 'rollup-plugin-terser'
import replace from '@rollup/plugin-replace'
import copy from 'rollup-plugin-copy'
const packageJson = require('./package.json')
export default [
{
input: 'src/index.ts',
output: [
{
file: packageJson.main,
format: 'cjs',
sourcemap: true,
},
{
file: packageJson.module,
format: 'esm',
sourcemap: true,
},
],
plugins: [
{
name: 'handle-dynamic-imports',
renderDynamicImport({ moduleId }) {
if (moduleId.includes('generateImageThumbnail')) {
return {
left: 'typeof window !== "undefined" ? import(',
right: ') : Promise.resolve()'
}
}
}
},
resolve(),
commonjs(),
typescript({ tsconfig: './tsconfig.json' }),
postcss({
include: '**/index.dark.css',
extract: 'css/index.dark.css'
}),
postcss({
include: '**/index.light.css',
extract: 'css/index.light.css'
}),
visualizer(),
autoExternal(),
cleanup(),
terser(),
replace({
'./src': './components/Docking/src',
delimiters: ['', '']
}),
copy({
targets: [
{ src: 'src/components/Docking/src/*', dest: 'dist/esm/components/Docking/src' }
]
}),
],
inlineDynamicImports: false
},
{
input: 'dist/esm/index.d.ts',
output: [{ file: 'dist/index.d.ts', format: 'esm' }],
plugins: [
dts(),
],
external: [/\.css$/]
},
{
input: 'dist/esm/css/index.dark.css',
output: [
{
file: 'dist/index.dark.css',
format: 'es'
}
],
plugins: [
postcss({
modules: true,
extract: true
})
]
},
{
input: 'dist/esm/css/index.light.css',
output: [
{
file: 'dist/index.light.css',
format: 'es'
}
],
plugins: [
postcss({
modules: true,
extract: true
})
]
}
]