-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
rollup.config.mjs
83 lines (78 loc) · 1.92 KB
/
rollup.config.mjs
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
// @ts-check
import typescript from '@rollup/plugin-typescript';
import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import nodePolyfills from 'rollup-plugin-polyfill-node';
import json from '@rollup/plugin-json';
import css from 'rollup-plugin-import-css';
import pkg from './package.json' with { type: 'json' };
/**
* Comment with library information to be appended in the generated bundles.
*/
const banner = `/*!
* ${pkg.name} v${pkg.version}
* (c) ${pkg.author}
* Released under the ${pkg.license} License.
*/
`;
/**
* Creates an output options object for Rollup.js.
* @param {import('rollup').OutputOptions} options
* @returns {import('rollup').OutputOptions}
*/
function createOutputOptions(options) {
return {
banner,
name: 'MusicXMLPlayer',
exports: 'named',
sourcemap: true,
...options,
};
}
/**
* @type {import('rollup').RollupOptions}
*/
const options = {
input: './src/index.ts',
output: [
// createOutputOptions({
// file: './dist/musicxml-player.js',
// format: 'commonjs',
// }),
// createOutputOptions({
// file: './dist/musicxml-player.cjs',
// format: 'commonjs',
// }),
// createOutputOptions({
// file: './dist/musicxml-player.mjs',
// format: 'esm',
// }),
createOutputOptions({
file: './dist/musicxml-player.esm.js',
format: 'esm',
inlineDynamicImports: true,
}),
// createOutputOptions({
// file: './dist/musicxml-player.umd.js',
// format: 'umd',
// }),
// createOutputOptions({
// file: './dist/musicxml-player.umd.min.js',
// format: 'umd',
// plugins: [terser()],
// }),
],
plugins: [
typescript({
tsconfig: './tsconfig.json',
}),
nodeResolve(),
commonjs(),
json(),
nodePolyfills(),
css({
output: 'musicxml-player.esm.css',
})
],
};
export default options;