-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
56 lines (54 loc) · 1.58 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
const UglifyJS = require('uglify-es')
const resolve = require('rollup-plugin-node-resolve')
const commonjs = require('rollup-plugin-commonjs')
const uglify = require('rollup-plugin-uglify').uglify
const json = require('rollup-plugin-json')
const replace = require('rollup-plugin-replace')
const filesize = require('rollup-plugin-filesize')
const buble = require('rollup-plugin-buble')
let production = function () {
return !process.env.ROLLUP_WATCH
}
module.exports = {
input: 'src/measurement-framework.js',
output: {
name: 'measurementFramework',
file: 'dist/measurement-framework.js',
format: 'iife', // immediately-invoked function expression — suitable for <script> tags
globals: {
window: 'window',
document: 'document'
}
},
treeshake: true,
external: ['window', 'document'],
plugins: [
json(),
replace({
'RMFBUILDTIME': new Date().toISOString()
}),
resolve({
mainFields: [
['jsnext', 'jsnext:main', true]
],
browser: true, // Default: false
extensions: ['.js', '.json'], // Default: ['.js']
preferBuiltins: true, // Default: true
modulesOnly: false, // Default: false
customResolveOptions: {}
}), // tells Rollup how to find date-fns in node_modules
commonjs(), // converts date-fns to ES modules
buble(),
production() && uglify({
toplevel: true,
ie8: true,
mangle: true,
compress: {
toplevel: true,
drop_console: true
// reduce_vars: false
}
}, UglifyJS.minify), // minify, but only in production
filesize()
]
}