Repository navigation
Expand file tree
/
Copy pathrollup.config.js
More file actions
90 lines (85 loc) · 2.22 KB
/
Copy pathrollup.config.js
File metadata and controls
90 lines (85 loc) · 2.22 KB
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
84
85
86
87
88
89
90
import fs from 'fs';
import resolve from '@rollup/plugin-node-resolve';
import babel from '@rollup/plugin-babel';
import eslint from '@rollup/plugin-eslint';
import dotenvx from '@dotenvx/dotenvx';
dotenvx.config();
dotenvx.config({
path: '.env.local',
override: true,
overload: true,
});
// import { sentryRollupPlugin } from '@sentry/rollup-plugin';
// import packageJson from './package.json' with { type: 'json' };
const common = {
context: 'window',
plugins: [
resolve(),
eslint({
overrideConfigFile: './eslint.config.js',
}),
babel({
babelHelpers: 'bundled',
comments: false,
sourceMaps: true,
plugins: [
['@babel/plugin-proposal-class-properties', { loose: true }],
'@babel/plugin-proposal-optional-chaining',
[
'babel-plugin-transform-replace-expressions',
{
replace: {
'globalThis.BARDETECTION_EDGE_RANGE': '32',
'globalThis.SENTRY_DSN': `'${process.env.SENTRY_DSN}'`,
},
},
],
],
}),
// sentryRollupPlugin({
// bundleSizeOptimizations: {
// excludeDebugStatements: true,
// excludeReplayIframe: true,
// excludeReplayShadowDom: true,
// excludeReplayWorker: true,
// excludeTracing: true,
// },
// release: {
// name: packageJson.version,
// },
// sourcemaps: {
// disable: true,
// },
// telemetry: false,
// // org: 'wessel-kroos',
// // project: '1524536',
// // // Auth tokens can be obtained from https://sentry.io/orgredirect/organizations/:orgslug/settings/auth-tokens/
// // authToken: process.env.SENTRY_AUTH_TOKEN,
// }),
],
};
const scripts = [
'background',
'options',
'content',
'content-main',
'injected',
'live-chat',
];
export default scripts.map((script) =>
Object.assign(
{},
{
input: `./src/scripts/${script}.js`,
output: {
file: `./dist/scripts/${script}.js`,
format: 'iife',
sourcemap: true,
intro: fs
.readFileSync('./src/scripts/intros/console.js', 'utf8')
.replaceAll(/.*\/\/ eslint-disable.*/g, ''),
},
},
common
)
);