-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
80 lines (75 loc) · 2.07 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
const commonjs = require('@rollup/plugin-commonjs')
const { nodeResolve: resolve } = require('@rollup/plugin-node-resolve')
const typescript = require('@rollup/plugin-typescript')
const copy = require('rollup-plugin-copy')
const { externals } = require('rollup-plugin-node-externals')
const external = require('rollup-plugin-peer-deps-external')
const postcss = require('rollup-plugin-postcss')
const { terser } = require('rollup-plugin-terser')
const packageJson = require('./package.json')
const { babel } = require('@rollup/plugin-babel')
const extensions = ['.js', '.jsx', '.ts', '.tsx']
module.exports = [
{
makeAbsoluteExternalsRelative: true,
preserveEntrySignatures: 'strict',
input: 'src/index.ts',
output: [
{
sourcemap: false,
file: packageJson.main,
format: 'cjs',
esModule: true,
generatedCode: {
reservedNamesAsProps: false
},
interop: 'compat',
systemNullSetters: false
}
],
onwarn(warning, warn) {
if (warning.code === 'THIS_IS_UNDEFINED') {
return
}
warn(warning)
},
plugins: [
externals({ react: 'react', 'react-dom': 'react-dom' }),
typescript({ tsconfig: './tsconfig.build.json' }),
babel({ extensions }),
external(),
resolve({ extensions }),
commonjs({ extensions }),
postcss({
modules: {
generateScopedName: '[name]__[local]'
},
extract: 'app-uikit.css',
minimize: true,
use: [
[
'sass',
{
data: '@import "src/styles/theme.scss"; @import "src/styles/fonts-prod.scss";'
}
]
]
}),
terser(),
copy({
targets: [
{
src: [
'src/fonts/editor-icons.eot',
'src/fonts/editor-icons.svg',
'src/fonts/editor-icons.ttf',
'src/fonts/editor-icons.woff',
'src/fonts/editor-icons.woff2'
],
dest: 'dist/fonts'
}
]
})
]
}
]