This repository has been archived by the owner on Sep 23, 2022. It is now read-only.
/
rollup.config.js
89 lines (88 loc) · 2.18 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// rollup.config.js
import { terser } from 'rollup-plugin-terser'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import typescript from 'rollup-plugin-typescript2'
import pkg from './package.json'
export default {
input: {
cryptoForage: 'src/cryptoForage.ts',
cryptoPrimitives: 'src/cryptoPrimitives.ts',
tauriForage: 'src/tauriForage.ts',
handler: 'src/handler.ts',
index: 'src/index.ts'
},
treeshake: true,
perf: true,
output: [
{
dir: 'dist/', // if you will be transpiling and minifying yourself
entryFileNames: '[name].esm.js',
format: 'esm',
sourcemap: true,
globals: {
readFile: 'this',
'tweetnacl-util': 'this'
}
},
{
dir: 'dist/', // if you want to consume in node but want it tiny
entryFileNames: '[name].cjs.min.js',
format: 'cjs',
plugins: [ terser() ],
globals: {
readFile: 'this',
'tweetnacl-util': 'this'
}
},
/*
{
dir: 'dist/', // if it needs to run in the browser
entryFileNames: '[name]/[name].umd.js',
format: 'umd',
name: 'filer',
globals: {
readFile: 'this'
},
sourcemap: true
},
{
dir: 'dist/', // if it needs to run in the browser
entryFileNames: '[name]/[name].umd.min.js',
format: 'umd',
plugins: [ terser() ],
name: 'filer',
globals: {
readFile: 'this'
}
}
*/
],
plugins: [
commonjs({
namedExports: {
// left-hand side can be an absolute path, a path
// relative to the current directory, or the name
// of a module in node_modules
'tweet-nacl': ['secretbox']
}}),
typescript({
typescript: require('typescript'),
}),
resolve({
// pass custom options to the resolve plugin
customResolveOptions: {
moduleDirectory: 'node_modules'
}
})
],
external: [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {})
],
watch: {
chokidar: true,
include: 'src/**',
exclude: 'node_modules/**'
}
}