MCPcopy
hub / github.com/tensorflow/tfjs / getBrowserBundleConfigOptions

Function getBrowserBundleConfigOptions

rollup.config.helpers.js:31–114  ·  view source on GitHub ↗
(
    config, name, fileName, preamble, visualize, ci, terserExtraOptions = {})

Source from the content-addressed store, hash-verified

29 * @param {object} terserExtraOptions is any extra options passed to terser
30 */
31export function getBrowserBundleConfigOptions(
32 config, name, fileName, preamble, visualize, ci, terserExtraOptions = {}) {
33 const bundles = [];
34
35 const terserPlugin =
36 terser({output: {preamble, comments: false}, ...terserExtraOptions});
37 const extend = true;
38 const umdFormat = 'umd';
39 const fesmFormat = 'es';
40
41 // UMD ES5 minified
42 bundles.push(config({
43 plugins: [terserPlugin],
44 output: {
45 format: umdFormat,
46 name,
47 extend,
48 file: `dist/${fileName}.min.js`,
49 freeze: false
50 },
51 tsCompilerOptions: {target: 'es5'},
52 visualize
53 }));
54
55 if (ci) {
56 // In CI we do not build all the possible bundles.
57 return bundles;
58 }
59
60 // UMD ES5 unminified
61 bundles.push(config({
62 output: {
63 format: umdFormat,
64 name,
65 extend,
66 file: `dist/${fileName}.js`,
67 freeze: false
68 },
69 tsCompilerOptions: {target: 'es5'}
70 }));
71
72 // UMD ES2017
73 bundles.push(config({
74 output:
75 {format: umdFormat, name, extend, file: `dist/${fileName}.es2017.js`},
76 tsCompilerOptions: {target: 'es2017'}
77 }));
78
79 // UMD ES2017 minified
80 bundles.push(config({
81 plugins: [terserPlugin],
82 output: {
83 format: umdFormat,
84 name,
85 extend,
86 file: `dist/${fileName}.es2017.min.js`
87 },
88 tsCompilerOptions: {target: 'es2017'},

Callers 1

rollup.config.jsFile · 0.90

Calls 2

configFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…