-
Notifications
You must be signed in to change notification settings - Fork 3
/
rollup.config.js
42 lines (36 loc) · 1.03 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
/* eslint-env node */
import { terser } from 'rollup-plugin-terser'
import filesize from 'rollup-plugin-filesize'
import { getBabelOutputPlugin } from '@rollup/plugin-babel'
import pkg from './package.json'
process.env.NODE_ENV = 'production'
const banner = `/** @license MIT smoothscroll-anchor-polyfill@${pkg.version} (c) 2021 Jonas Kuske */`
const esmPreset = ['@babel/preset-env', { targets: { esmodules: true }, bugfixes: true }]
const babelESM = getBabelOutputPlugin({ presets: [esmPreset] })
const babelUMD = getBabelOutputPlugin(pkg.babel)
export default {
plugins: [filesize({ showMinifiedSize: false })],
input: 'src/index.js',
output: [
{
banner,
file: pkg.module,
plugins: [babelESM],
},
{
// banner,
file: pkg.module.replace(/\.mjs$/, '.min.mjs'),
plugins: [babelESM, terser()],
},
{
banner,
file: pkg.main,
plugins: [babelUMD],
},
{
// banner,
file: pkg.main.replace(/\.js$/, '.min.js'),
plugins: [babelUMD, terser()],
},
],
}