-
Notifications
You must be signed in to change notification settings - Fork 9
/
rollup.config.js
80 lines (78 loc) · 1.63 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
// rollup.config.js
import typescript from 'rollup-plugin-typescript2';
import * as path from 'path';
import * as fs from 'fs';
import pkg from './package.json';
import sass from 'rollup-plugin-sass';
import copy from 'rollup-plugin-copy';
import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import svgr from '@svgr/rollup';
import url from '@rollup/plugin-url';
const config = [{
input: 'src/index.ts',
output: [{
name: 'UUI',
file: pkg.main,
format: 'umd',
plugins: [
],
globals: {
'react': 'React',
'react-dom': 'ReactDOM',
'react-popper': 'ReactPopper',
'prop-types': 'PropTypes',
},
},
{
name: 'UUI',
file: pkg.module,
format: 'es',
plugins: [
],
}],
external: [
"react", "react-dom", "prop-types",
"@popperjs/core", "react-popper",
],
plugins: [
url(),
svgr(),
nodeResolve({
browser: true,
}),
commonjs(),
typescript({
tsconfig: path.join(__dirname, 'tsconfig.json'),
typescript: require("typescript"),
}),
copy({
targets: [
{ src: 'src/styles', dest: 'lib' },
]
}),
],
}, {
input: 'src/styles/index.scss',
output: {
file: 'lib/style.tmp.js',
},
plugins: [
sass({
output: 'lib/index.css',
runtime: require('sass'),
options: {
fiber: require('fibers'),
}
}),
(() => {
return {
name: 'cleaner',
writeBundle: (options, bundle) => {
fs.unlinkSync(path.join(__dirname, './lib/style.tmp.js'))
}
}
})(),
],
}];
export default config;