-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrollup.config.ts
47 lines (45 loc) · 1 KB
/
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
43
44
45
46
47
import resolve from '@rollup/plugin-node-resolve';
import path from 'path';
import dts from 'rollup-plugin-dts';
import esbuild from 'rollup-plugin-esbuild';
import { externals } from 'rollup-plugin-node-externals';
import pkg from './package.json' assert { type: 'json' };
const packagePath = './package.json';
export default [
{
input: 'src/index.ts',
plugins: [
externals({
deps: true,
include: ['react', '@grafana/data', '@grafana/ui', '@grafana/runtime', 'lodash'],
packagePath,
}),
resolve(),
esbuild(),
],
output: [
{
format: 'cjs',
sourcemap: true,
dir: path.dirname(pkg.main),
},
{
format: 'esm',
sourcemap: true,
dir: path.dirname(pkg.module),
preserveModules: true,
},
],
},
{
input: './compiled/index.d.ts',
plugins: [dts()],
output: {
file: pkg.types,
format: 'es',
},
watch: {
exclude: './compiled/**',
},
},
];