-
Notifications
You must be signed in to change notification settings - Fork 129
/
rollup.config.js
45 lines (42 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
import commonjs from '@rollup/plugin-commonjs'
import { terser } from 'rollup-plugin-terser'
import sizeCheck from 'rollup-plugin-filesize-check'
import { nodeResolve } from '@rollup/plugin-node-resolve' //import https
import { version } from './package.json'
console.log('\n 📦 - running rollup..\n')
const name = 'wtf-plugin-image'
const banner = `/* ${name} ${version} MIT */`
export default [
// === es-module ===
{
input: 'src/index.js',
output: [{ banner: banner, file: `builds/${name}.mjs`, format: 'esm' }],
external: ['isomorphic-unfetch'],
plugins: [
nodeResolve(),
commonjs({ requireReturnsDefault: "auto" }),
]
},
// === .js ===
{
input: 'src/index.js',
output: [{ banner: banner, file: `builds/${name}.cjs`, format: 'umd', name: 'wtfImage', sourcemap: false, globals: { "isomorphic-unfetch": 'unfetch' } }],
external: ['isomorphic-unfetch'],
plugins: [
nodeResolve(),
commonjs({ requireReturnsDefault: "auto" })
]
},
// === min.js ===
{
input: 'src/index.js',
output: [{ banner: banner, file: `builds/${name}.min.js`, format: 'umd', name: 'wtfImage', sourcemap: false, globals: { "isomorphic-unfetch": 'unfetch' } }],
external: ['isomorphic-unfetch'],
plugins: [
nodeResolve(),
commonjs({ requireReturnsDefault: "auto" }),
terser(),
sizeCheck({ expect: 24, warn: 10 })
]
}
]