-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
63 lines (62 loc) · 2.28 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
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import { terser } from 'rollup-plugin-terser'
import json from '@rollup/plugin-json'
export default [
// ### Node JS ###
// CommonJS and ES module
{
input: './src/index-node.js',
output: [
{ file: './dist/otp-ed-lib.nodejs.cjs.js', format: 'cjs', exports: 'named' },
{ file: './dist/otp-ed-lib.nodejs.esm.mjs', format: 'es' }
],
plugins: [
resolve(), // so Rollup can find `ms`
commonjs(), // so Rollup can convert `ms` to an ES module
json() // for Rollup to be able to read content from codebook-emojis.json
]
},
// CommonJS and ES module, minified versions
{
input: './src/index-node.js',
output: [
{ file: './dist/otp-ed-lib.nodejs.cjs.min.js', format: 'cjs', exports: 'named' },
{ file: './dist/otp-ed-lib.nodejs.esm.min.mjs', format: 'es' }
],
plugins: [
resolve(), // so Rollup can find `ms`
commonjs(), // so Rollup can convert `ms` to an ES module
terser(), // Minify
json() // for Rollup to be able to read content from codebook-emojis.json
]
},
// ### Browsers ###
// UMD and ES module
{
input: './src/index-browser.js',
output: [
{ name: 'otp', file: './dist/otp-ed-lib.browser.umd.js', format: 'umd', exports: 'named', globals: { crypto: 'globalVariable' } },
{ file: './dist/otp-ed-lib.browser.esm.mjs', format: 'es', globals: { crypto: 'globalVariable' } }
],
plugins: [
resolve(), // so Rollup can find `ms`
commonjs(), // so Rollup can convert `ms` to an ES module
json() // for Rollup to be able to read content from codebook-emojis.json
]
},
// UMD and ES module, minified versions
{
input: './src/index-browser.js',
output: [
{ name: 'otp', file: './dist/otp-ed-lib.browser.umd.min.js', format: 'umd', exports: 'named', globals: { crypto: 'globalVariable' } },
{ file: './dist/otp-ed-lib.browser.esm.min.mjs', format: 'es', globals: { crypto: 'globalVariable' } }
],
plugins: [
resolve(), // so Rollup can find `ms`
commonjs(), // so Rollup can convert `ms` to an ES module
terser(), // Minify
json() // for Rollup to be able to read content from codebook-emojis.json
]
}
]