This repository has been archived by the owner on Jul 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
rollup.config.js
83 lines (80 loc) · 2.12 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
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
// import async from 'rollup-plugin-async';
import builtins from 'rollup-plugin-node-builtins';
import globals from 'rollup-plugin-node-globals';
import pkg from './package.json';
export default [
// browser-friendly UMD build
{
input: 'src/main.mjs',
output: {
exports: 'named',
file: pkg.browser,
name: 'modelscript',
format: 'umd',
},
plugins: [
resolve({
preferBuiltins: true,
}), // so Rollup can find `ms`
commonjs({
namedExports: {
// left-hand side can be an absolute path, a path
// relative to the current directory, or the name
// of a module in node_modules
// 'node_modules/ml-array-utils/src/index.js': [ 'scale', ],
// 'node_modules/probability-distributions/index.js': [ 'rbeta', ],
},
}), // so Rollup can convert `ms` to an ES module
builtins({
}),
globals({
}),
],
},
// CommonJS (for Node) and ES module (for bundlers) build.
// (We could have three entries in the configuration array
// instead of two, but it's quicker to generate multiple
// builds from a single configuration where possible, using
// an array for the `output` option, where we can specify
// `file` and `format` for each target)
{
input: 'src/main.mjs',
external: [
'valid-url',
'csvtojson',
'http',
'https',
'ml',
'lodash.range',
'lodash.rangeright',
'node-fpgrowth',
'object.values',
'ml-random-forest',
'ml-logistic-regression',
'ml-regression-multivariate-linear',
'ml-cart',
'ml-pca',
'ml-naivebayes',
'random-js',
'natural',
'js-grid-search-lite',
'probability-distributions',
],
output: [
{
exports: 'named',
file: pkg.commonjs,
name: 'modelscript',
format: 'cjs',
},
{
exports: 'named',
file: pkg.esm,
name: 'modelscript',
format: 'es',
},
],
},
];