-
Notifications
You must be signed in to change notification settings - Fork 49
/
rollup.config.js
46 lines (40 loc) · 1.11 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
import babel from '@rollup/plugin-babel'
import resolve from '@rollup/plugin-node-resolve'
import flowEntry from 'rollup-plugin-flow-entry'
import mjs from 'rollup-plugin-mjs-entry'
import packageJson from './package.json'
const extensions = ['.ts']
const babelOpts = {
babelHelpers: 'bundled',
babelrc: false,
extensions,
plugins: ['babel-plugin-transform-fake-error-class'],
presets: ['@babel/preset-typescript', '@babel/preset-react']
}
const external = ['crypto', ...Object.keys(packageJson.dependencies)]
const resolveOpts = { extensions }
// Produces the Node entry point and standalone type definition files.
export default [
{
external,
input: './src/index.ts',
output: { file: packageJson.main, format: 'cjs' },
plugins: [
resolve(resolveOpts),
babel(babelOpts),
flowEntry({ types: './lib/flow/exports.js' }),
mjs()
]
},
{
external,
input: './src/types/types.ts',
output: { file: './types.js', format: 'cjs' },
plugins: [
resolve(resolveOpts),
babel(babelOpts),
flowEntry({ types: './lib/flow/types.js' }),
mjs()
]
}
]