-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
96 lines (87 loc) · 1.68 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
import { getBabelOutputPlugin } from '@rollup/plugin-babel';
import typescript from '@rollup/plugin-typescript';
import { terser } from 'rollup-plugin-terser';
// import { execSync } from 'child_process';
const OUTPUT_DIRECTORY = 'dist';
const production = process.env.DEV === undefined && !process.env.ROLLUP_WATCH;
const input = 'src/mixmix.ts';
const output = {
sourcemap: true,
format: 'umd',
name: 'mixmix',
};
const watch = {
clearScreen: false,
};
const config = [{
input,
output: {
...output,
file: `${OUTPUT_DIRECTORY}/mixmix.js`
},
watch,
plugins: [
typescript(),
// !production && {
// writeBundle() {
// try {
// // "npm config set color always" to get colour output
// execSync('npx jest');
// } catch (err) {
// // console.log(err);
// }
// },
// },
],
}, {
input,
output: {
...output,
file: `${OUTPUT_DIRECTORY}/mixmix.min.js`
},
watch,
plugins: [
typescript(),
terser(),
],
}, {
input,
output: {
...output,
format: 'esm',
file: `${OUTPUT_DIRECTORY}/mixmix.min.esm.js`
},
watch,
plugins: [
typescript(),
terser(),
],
}, {
input,
output: {
...output,
format: 'esm',
file: `${OUTPUT_DIRECTORY}/mixmix.min.es5.js`
},
watch,
plugins: [
typescript(),
getBabelOutputPlugin({
presets: ['@babel/preset-env'],
// extensions: ['.js', '.ts'],
// include: ['src/**'],
// babelHelpers: 'bundled',
plugins: [
'@babel/plugin-transform-modules-umd'
],
// allowAllFormats: true,
}),
terser(),
],
}];
if (!production) {
config.pop();
config.pop();
config.pop();
}
export default config;