/
rollup.config.js
58 lines (54 loc) · 1.52 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
import fs from 'fs';
import babel from '@rollup/plugin-babel';
import nodeResolve from '@rollup/plugin-node-resolve';
import dts from "rollup-plugin-dts";
import { terser } from 'rollup-plugin-terser';
// import { sizeSnapshot } from 'rollup-plugin-size-snapshot';
const { version } = JSON.parse(fs.readFileSync(new URL('./package.json', import.meta.url)));
const input = './src/index.ts';
const name = 'glMatrixEval';
const extensions = ['.js', '.ts'];
const external = ['gl-matrix'];
const globals = { 'gl-matrix': 'glMatrix' };
const babelHelpers = "bundled";
const bannerPlugin = {
banner: `/*!
@fileoverview gl-matrix-eval
@author Hugehard Zhang
@version ${version}
*/`
}
export default [
{
input,
output: { file: 'dist/index.d.ts', format: 'es', name },
plugins: [dts()]
},
{
input,
external,
output: { file: 'dist/index.js', format: 'umd', name, globals },
plugins: [
bannerPlugin,
nodeResolve({
extensions,
}),
babel({ extensions, babelHelpers })
]
},
{
input,
external,
output: { file: 'dist/index.min.js', format: 'umd', name, globals },
plugins: [
bannerPlugin,
nodeResolve({
extensions,
}),
babel({ extensions, babelHelpers }),
terser({
output: { comments: /^!/ }
})
]
}
];