-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.ts
42 lines (36 loc) · 1013 Bytes
/
rollup.config.ts
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
import * as path from 'path'
import {glob} from 'glob'
import rollupTypescript from '@rollup/plugin-typescript'
import dts from "rollup-plugin-dts";
import {Plugin as RollupPlugin} from 'rollup';
// basic rollup config setup
const baseConfig = (input: string, output: string, plugins: RollupPlugin[]) => ({
input: input,
output: {
file: output,
format: 'es',
},
plugins,
})
// common plugins setup
const commonPlugins = (tsconfigPath: string) => [
rollupTypescript({tsconfig: tsconfigPath})
]
export default [
// library
baseConfig('src/index.ts', 'dist/index.js', commonPlugins('tsconfig.core.json')),
// library typings
{
input: 'src/index.ts',
output: {
//file: 'dist/index.d.ts',
dir: 'dist/',
format: 'es',
preserveModules: true
},
plugins: [dts()],
},
// examples
...glob.sync('examples/*/showcaseScenario.ts')
.map(item => baseConfig(item, 'dist/' + item.replace('.ts', '.js'), commonPlugins('tsconfig.examples.json'))),
];