-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathrollup.config.js
86 lines (81 loc) · 1.84 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
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
import replace from '@rollup/plugin-replace'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import { terser } from 'rollup-plugin-terser'
import stripCode from 'rollup-plugin-strip-code'
import pkg from './package.json'
const sharedPlugins = [
replace({
preventAssignment: false,
exclude: 'node_modules/**',
__VERSION__: pkg.version
}),
commonjs({
ignoreDynamicRequires: true,
}),
resolve({
preferBuiltins: true // Plugin node-resolve: preferring built-in module 'buffer' over local alternative
})
]
export default [
// Browser build
{
input: 'build/src/browser.js',
output: {
name: 'Honeybadger',
file: pkg.browser,
format: 'umd',
sourcemap: true
},
plugins: sharedPlugins
},
// Browser build (minified)
{
input: 'build/src/browser.js',
output: {
name: 'Honeybadger',
file: 'dist/browser/honeybadger.min.js',
format: 'umd',
sourcemap: true
},
plugins: [...sharedPlugins, terser()]
},
// Chrome Extension build (minified) - https://github.com/honeybadger-io/honeybadger-js/issues/1383
{
input: 'build/src/browser.js',
output: {
name: 'Honeybadger',
file: 'dist/browser/honeybadger.ext.min.js',
format: 'umd',
sourcemap: true
},
plugins: [
stripCode({
start_comment: 'ROLLUP_STRIP_CODE_CHROME_EXTENSION_START',
end_comment: 'ROLLUP_STRIP_CODE_CHROME_EXTENSION_END'
}),
...sharedPlugins,
terser()
]
},
// Server build
{
input: 'build/src/server.js',
external: [
'http',
'https',
'url',
'os',
'fs',
'util',
'domain',
'async_hooks',
],
output: {
file: pkg.main,
format: 'cjs',
sourcemap: true
},
plugins: sharedPlugins
}
]