-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrollup.config.js
48 lines (46 loc) · 1.39 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
import { optimizeLodashImports } from '@optimize-lodash/rollup-plugin';
import babel from '@rollup/plugin-babel';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import fs from 'fs';
import path from 'path';
import license from 'rollup-plugin-license';
import { terser } from 'rollup-plugin-terser';
const licenseFile = fs.readFileSync(path.join(__dirname, 'LICENSE'), 'utf8');
const pageLifecyclelicenseFile = fs.readFileSync(
path.join(__dirname, 'page-lifecycle.LICENSE.txt'),
'utf8'
);
export default {
input: 'src/index.js',
output: [
{
file: 'dist/wpt.js',
format: 'iife',
name: 'Woopra'
},
{
file: 'dist/w.js',
format: 'iife',
sourcemap: true,
name: 'Woopra',
plugins: [terser({ ecma: 5 })]
}
],
plugins: [
nodeResolve(),
babel({ babelHelpers: 'bundled' }),
optimizeLodashImports(),
license({
banner: {
commentStyle: 'ignored',
content: `Copyright (c) <%= moment().format('YYYY') %> Woopra, Inc.\n\nFor license information please see https://static.woopra.com/js/w.js.LICENSE.txt`
},
thirdParty: {
output: {
file: path.join(__dirname, 'dist', 'w.js.LICENSE.txt'),
template: `${licenseFile}\n\n\n${pageLifecyclelicenseFile}\n\n<% _.forEach(dependencies, function (dependency) { %><%= dependency.text() %><% }) %>`
}
}
})
]
};