-
Notifications
You must be signed in to change notification settings - Fork 3
/
rollup.config.js
76 lines (69 loc) · 1.7 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
import nodeResolve from 'rollup-plugin-node-resolve';
import {terser} from 'rollup-plugin-terser';
import typescript from 'rollup-plugin-typescript2';
const LICENSE = `/*
* Copyright (c) 2019, Andreas Madsen
* All rights reserved.
*
* Cephes is LICENSED with special permision under BSD.
* Copyright (c) 2019, Steven Moshier
* All rights reserved.
*
*/`;
function config({plugins = [], output = {}}) {
return {
input: 'src/index.ts',
plugins: [
typescript({
tsconfigOverride: {compilerOptions: {module: 'ES2015'}}
}),
nodeResolve(),
...plugins
],
output: {
banner: LICENSE,
sourcemap: true,
globals: {
'@tensorflow/tfjs-core': 'tf'
},
...output
},
external: ['@tensorflow/tfjs-core']
};
}
module.exports = function (cmdOptions) {
const bundles = [];
// tf-core.js
bundles.push(config({
plugins: [],
output: {
format: 'umd',
name: 'tfspecial',
extend: true,
file: 'dist/tfjs-special.js',
}
}));
// tf-core.min.js
bundles.push(config({
plugins: [terser({
output: { preamble: LICENSE }
})],
output: {
format: 'umd',
name: 'tfspecial',
extend: true,
file: 'dist/tfjs-special.min.js',
}
}));
// tf-core.esm.js
bundles.push(config({
plugins: [terser({
output: { preamble: LICENSE }
})],
output: {
format: 'es',
file: 'dist/tfjs-special.esm.js',
}
}));
return bundles;
};