-
Notifications
You must be signed in to change notification settings - Fork 129
/
rollup.config.js
51 lines (47 loc) · 1.33 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
import commonjs from '@rollup/plugin-commonjs'
import terser from '@rollup/plugin-terser'
import { nodeResolve } from '@rollup/plugin-node-resolve'
console.log('\n 📦 - running rollup..\n')
const banner = '/*! wtf_wikipedia MIT */'
export default [
// === server-side .mjs (typescript)===
{
input: 'src/index.js',
output: [{ banner: banner, file: 'builds/wtf_wikipedia.mjs', format: 'esm' }],
external: ['isomorphic-unfetch'],
plugins: [
commonjs()
],
},
// === server-side .js ===
{
input: 'src/index.js',
output: [{ banner: banner, file: 'builds/wtf_wikipedia.cjs', format: 'umd', name: 'wtf', globals: { "isomorphic-unfetch": 'unfetch' } }],
external: ['isomorphic-unfetch'],
plugins: [
commonjs()
],
},
// === client-side min.js ===
{
input: 'src/index.js',
output: [{ banner: banner, file: 'builds/wtf_wikipedia-client.min.js', format: 'umd', name: 'wtf', sourcemap: false }],
plugins: [
nodeResolve({
browser: true
}),
commonjs(),
terser(),
],
},
// === client-side .mjs ===
{
input: 'src/index.js',
output: [{ banner: banner, file: 'builds/wtf_wikipedia-client.mjs', format: 'esm', name: 'wtf', sourcemap: false }],
plugins: [
nodeResolve({ browser: true }),
commonjs(),
terser(),
],
},
]