This repository has been archived by the owner on Apr 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathrollup.config.addon.js
60 lines (58 loc) · 2.24 KB
/
rollup.config.addon.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
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import replace from '@rollup/plugin-replace';
export default (cliArgs) => {
return [
{
input: "core-addon/background.js",
output: {
file: "public/addon-build/background.js"
},
plugins: [
replace({
// Turn this on to both disable the build-time warning and prepare for future releases,
// since this will become the default value.
preventAssignment: true,
// NOTE: if this URL ever changes, you will have to update the domain in
// the permissions in manifest.json.
__STUDIES_LIST__: cliArgs['config-studies-list-url'] ?
`'${cliArgs['config-studies-list-url']}'` :
"'https://firefox.settings.services.mozilla.com/v1/buckets/main/collections/rally-studies-v2/records'",
__DISABLE_REMOTE_SETTINGS__: !!cliArgs["config-disable-remote-settings"],
__BASE_SITE__: "https://rally.mozilla.org",
// Data submission is disabled by default. Use this option via the CLI
// to enable it for testing until https://github.com/mozilla-rally/core-addon/issues/304
// is fixed.
__ENABLE_DATA_SUBMISSION__: !!cliArgs["config-enable-data-submission"],
// In order to ease the integration, Glean will be embedded in the code but disabled
// until the integration is fully complete.
__ENABLE_GLEAN__: !!cliArgs["config-enable-glean"],
__WEBSITE_URL__: cliArgs['config-website'] ?
`'${cliArgs['config-website']}'` :
"'https://rally.mozilla.org'",
}),
resolve({
exportConditions: ["browser"],
// This is required in order for rollup to pick up
// the correct dependencies for ping encryption.
preferBuiltins: false,
}),
commonjs(),
],
},
{
input: "core-addon/content-script.js",
output: {
file: "public/addon-build/content-script.js"
},
plugins: [
resolve({
browser: true,
}),
commonjs(),
],
},
]};