-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
76 lines (69 loc) · 1.61 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
// rollup.config.js
import fs from 'fs'
import path from 'path'
import commonjs from '@rollup/plugin-commonjs'
import babel from '@rollup/plugin-babel'
import { terser } from 'rollup-plugin-terser'
// Get browserslist config and remove ie from es build targets
const esbrowserslist = fs
.readFileSync('./.browserslistrc')
.toString()
.split('\n')
.filter(entry => entry && entry.substring(0, 2) !== 'ie')
const babelBaseConfig = {
exclude: 'node_modules/**',
extensions: ['.js'],
babelHelpers: 'bundled'
}
// Customize configs for individual targets
const buildFormats = []
const esConfig = {
input: 'src/tooltip.js',
output: {
file: 'dist/vue-follow-tooltip.esm.js',
format: 'esm',
exports: 'named'
},
plugins: [
commonjs(),
babel({
...babelBaseConfig,
presets: [['@babel/preset-env', { targets: esbrowserslist }]]
})
]
}
buildFormats.push(esConfig)
const umdConfig = {
input: 'src/tooltip.js',
output: {
compact: true,
file: 'dist/vue-follow-tooltip.ssr.js',
format: 'cjs',
name: 'Tooltip',
exports: 'auto'
},
plugins: [commonjs(), babel(babelBaseConfig)]
}
buildFormats.push(umdConfig)
const unpkgConfig = {
input: 'src/tooltip.js',
output: {
compact: true,
file: 'dist/vue-follow-tooltip.min.js',
format: 'iife',
name: 'Tooltip',
exports: 'auto'
},
plugins: [
commonjs(),
babel(babelBaseConfig),
terser({
output: {
ecma: 5
}
})
]
}
buildFormats.push(unpkgConfig)
// Export config
export default buildFormats