mirror of
https://github.com/grafana/grafana.git
synced 2025-01-23 15:03:41 -06:00
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
|
import image from '@rollup/plugin-image';
|
||
|
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';
|
||
|
|
||
|
const pkg = require('./package.json');
|
||
|
|
||
|
export default [
|
||
|
{
|
||
|
input: 'src/index.ts',
|
||
|
plugins: [externals({ deps: true, packagePath: './package.json' }), resolve(), esbuild(), image()],
|
||
|
output: [
|
||
|
{
|
||
|
format: 'cjs',
|
||
|
sourcemap: true,
|
||
|
dir: path.dirname(pkg.publishConfig.main),
|
||
|
},
|
||
|
{
|
||
|
format: 'esm',
|
||
|
sourcemap: true,
|
||
|
dir: path.dirname(pkg.publishConfig.module),
|
||
|
preserveModules: true,
|
||
|
// @ts-expect-error (TS cannot assure that `process.env.PROJECT_CWD` is a string)
|
||
|
preserveModulesRoot: path.join(process.env.PROJECT_CWD, `packages/grafana-prometheus/src`),
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
{
|
||
|
input: './compiled/index.d.ts',
|
||
|
plugins: [dts()],
|
||
|
output: {
|
||
|
file: pkg.publishConfig.types,
|
||
|
format: 'es',
|
||
|
},
|
||
|
},
|
||
|
];
|