-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.lib.js
38 lines (34 loc) · 1010 Bytes
/
rollup.config.lib.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
import typescript from 'rollup-plugin-typescript2'
import typescriptCompiler from 'typescript'
import commonjs from '@rollup/plugin-commonjs'
import resolve from '@rollup/plugin-node-resolve'
import { terser } from 'rollup-plugin-terser'
import pkg from './package.json'
const externals = [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
]
const regexesOfPackages = externals // To prevent having node_modules in the build files
.map(packageName => new RegExp(`^${packageName}(/.*)?`))
const plugins = [
typescript({
tsconfig: './tsconfig.lib.json',
typescript: typescriptCompiler,
}),
resolve(),
commonjs({ include: 'node_modules/**', extensions: ['.js', '.ts'] }),
terser(),
]
module.exports = {
input: ['src/index.ts', 'src/run/index.ts', 'src/utils/index.ts'],
external: regexesOfPackages,
output: [
{
dir: 'lib',
format: 'esm',
preserveModules: true,
preserveModulesRoot: './src',
},
],
plugins,
}