-
Notifications
You must be signed in to change notification settings - Fork 3
/
rollup.config.js
41 lines (38 loc) · 974 Bytes
/
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
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
const typescript = require('@rollup/plugin-typescript');
const copy = require('rollup-plugin-copy');
const dotenv = require('rollup-plugin-dotenv').default;
const { nodeResolve } = require('@rollup/plugin-node-resolve');
// removes export statements since they are not recognized by apps script, but rollup always puts them in for esm output
const removeExports = () => {
return {
name: 'remove-exports',
renderChunk(code) {
return code.replace(/export [^;]+?;/g, '');
},
};
};
module.exports = {
input: 'src/index.ts',
output: {
dir: 'dist',
format: 'esm',
name: 'MatomoLookerStudio',
},
plugins: [
nodeResolve(),
typescript(),
dotenv(),
copy({
targets: [
{ src: 'src/appsscript.json', dest: 'dist' },
],
}),
removeExports(),
],
};