-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathrollup.config.js
58 lines (50 loc) · 1.15 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
// Copyright 2023 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview Bundle up for release.
*/
import terser from '@rollup/plugin-terser';
import gitInfo from 'rollup-plugin-git-info';
const plugins = [];
if (process.env.NODE_ENV === 'production') {
plugins.push(terser());
}
// Common output settings.
const output = {
// This only disables the '__esModule' symbol hack.
esModule: false,
format: 'es',
indent: false,
preferConst: true,
};
// The files we'll build. The deps target must be first.
let targets = [
// Resources.
{
input: 'js/deps_resources.shim.js',
output: {
...output,
file: 'dist/js/libdot_resources.js',
},
plugins: [
...plugins,
// Always run terser on these files as it's all generated anyways.
terser(),
gitInfo(),
],
},
// Main lib.
{
input: 'index.js',
output: {
...output,
file: 'dist/js/libdot.js',
},
plugins,
},
];
if (process.env.LIBAPPS_DEPS_ONLY !== undefined) {
targets = targets.slice(0, 1);
}
export default [...targets];