-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
53 lines (48 loc) · 1.06 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
import path from 'path';
import buble from '@rollup/plugin-buble';
import minify from 'rollup-plugin-minify-es';
const sharedConfig = {
input: 'src/firecrypt.js',
external: [
'lru-cache',
'crypto-js',
'cryptojs-extension',
],
};
const nodeConfig = {...sharedConfig};
nodeConfig.output = {
file: path.resolve(__dirname, 'dist/node/firecrypt.js'),
name: 'firecrypt',
format: 'cjs',
sourcemap: true,
};
const unminifiedBrowserConfig = {
plugins: [
buble({transforms: {dangerousForOf: true}}),
],
...sharedConfig
};
unminifiedBrowserConfig.output = {
file: path.resolve(__dirname, 'dist/browser/firecrypt.js'),
name: 'firecrypt',
format: 'iife',
sourcemap: true,
};
const minifiedBrowserConfig = {
plugins: [
buble({transforms: {dangerousForOf: true}}),
minify()
],
...sharedConfig
};
minifiedBrowserConfig.output = {
file: path.resolve(__dirname, 'dist/browser/firecrypt.min.js'),
name: 'firecrypt',
format: 'iife',
sourcemap: true,
};
export default [
unminifiedBrowserConfig,
minifiedBrowserConfig,
nodeConfig,
];