mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 20:24:18 -06:00
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import resolve from '@rollup/plugin-node-resolve';
|
|
import commonjs from '@rollup/plugin-commonjs';
|
|
import image from '@rollup/plugin-image';
|
|
import { terser } from 'rollup-plugin-terser';
|
|
|
|
const pkg = require('./package.json');
|
|
|
|
const libraryName = pkg.name;
|
|
|
|
const buildCjsPackage = ({ env }) => {
|
|
return {
|
|
input: `compiled/index.js`,
|
|
output: [
|
|
{
|
|
dir: 'dist',
|
|
name: libraryName,
|
|
format: 'cjs',
|
|
sourcemap: true,
|
|
strict: false,
|
|
exports: 'named',
|
|
chunkFileNames: `[name].${env}.js`,
|
|
globals: {
|
|
react: 'React',
|
|
'prop-types': 'PropTypes',
|
|
},
|
|
},
|
|
],
|
|
external: [
|
|
'react',
|
|
'react-dom',
|
|
'@grafana/aws-sdk',
|
|
'@grafana/data',
|
|
'@grafana/schema',
|
|
'@grafana/e2e-selectors',
|
|
'moment',
|
|
'jquery', // required to use jquery.plot, which is assigned externally
|
|
],
|
|
plugins: [
|
|
commonjs({
|
|
include: /node_modules/,
|
|
}),
|
|
resolve(),
|
|
image(),
|
|
env === 'production' && terser(),
|
|
],
|
|
};
|
|
};
|
|
export default [buildCjsPackage({ env: 'development' }), buildCjsPackage({ env: 'production' })];
|