-
Notifications
You must be signed in to change notification settings - Fork 63
/
rollup.config.js
91 lines (85 loc) · 1.66 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
import sass from 'rollup-plugin-sass';
import typescript from '@rollup/plugin-typescript';
import { terser } from 'rollup-plugin-terser';
import { string } from 'rollup-plugin-string';
import babel from '@rollup/plugin-babel';
import pkg from './package.json';
const banner =
`/**
* ${pkg.name}@${pkg.version}
* ${pkg.repository.url}
* @author ${pkg.author} (@cifkao)
* @license ${pkg.license}
*/
`;
const commonPlugins = [
sass(),
string({
include: ['src/assets/**/*.svg']
}),
];
const umdOutOptions = {
format: 'umd',
name: 'midiPlayer',
globals: {
'@magenta/music/esm/core.js': 'core'
},
banner: banner
};
export default [
{
input: 'src/index.ts',
output: {
file: pkg.module,
format: 'es',
banner: banner,
},
plugins: [
typescript({
target: 'es2017'
}),
...commonPlugins
],
external: [
'@magenta/music/esm/core.js',
'tslib'
]
},
{
input: 'src/index.ts',
output: [
{
file: 'dist/midi-player.js',
...umdOutOptions,
},
{
file: 'dist/midi-player.min.js',
sourcemap: true,
...umdOutOptions,
plugins: [
terser()
]
},
],
plugins: [
typescript({
target: 'esnext'
}),
babel({
extensions: ['.ts', '.js'],
presets: [
[
'@babel/preset-env', {
targets: 'supports audio-api and supports custom-elementsv1 and supports shadowdomv1'
}
],
],
babelHelpers: 'bundled'
}),
...commonPlugins
],
external: [
'@magenta/music/esm/core.js'
]
}
]