2020-03-15 10:39:40 -05:00
|
|
|
import resolve from '@rollup/plugin-node-resolve';
|
|
|
|
import commonjs from '@rollup/plugin-commonjs';
|
2020-05-05 03:39:49 -05:00
|
|
|
import image from '@rollup/plugin-image';
|
2019-02-21 03:58:28 -06:00
|
|
|
import { terser } from 'rollup-plugin-terser';
|
|
|
|
|
|
|
|
const pkg = require('./package.json');
|
|
|
|
|
|
|
|
const libraryName = pkg.name;
|
|
|
|
|
|
|
|
const buildCjsPackage = ({ env }) => {
|
|
|
|
return {
|
|
|
|
input: `compiled/index.js`,
|
|
|
|
output: [
|
|
|
|
{
|
2020-06-30 02:22:09 -05:00
|
|
|
dir: 'dist',
|
2019-02-21 03:58:28 -06:00
|
|
|
name: libraryName,
|
|
|
|
format: 'cjs',
|
|
|
|
sourcemap: true,
|
2020-01-03 03:02:27 -06:00
|
|
|
strict: false,
|
2019-02-21 03:58:28 -06:00
|
|
|
exports: 'named',
|
2020-06-30 02:22:09 -05:00
|
|
|
chunkFileNames: `[name].${env}.js`,
|
2019-02-21 03:58:28 -06:00
|
|
|
globals: {
|
|
|
|
react: 'React',
|
|
|
|
'prop-types': 'PropTypes',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2020-06-29 12:58:47 -05:00
|
|
|
external: [
|
|
|
|
'react',
|
|
|
|
'react-dom',
|
2021-03-30 05:30:34 -05:00
|
|
|
'@grafana/aws-sdk',
|
2020-06-29 12:58:47 -05:00
|
|
|
'@grafana/data',
|
|
|
|
'@grafana/e2e-selectors',
|
|
|
|
'moment',
|
|
|
|
'monaco-editor', // Monaco should not be used directly
|
|
|
|
'monaco-editor/esm/vs/editor/editor.api', // Monaco should not be used directly
|
|
|
|
'react-monaco-editor',
|
2020-09-22 03:43:57 -05:00
|
|
|
'jquery', // required to use jquery.plot, which is assigned externally
|
2020-06-29 12:58:47 -05:00
|
|
|
],
|
2019-02-21 03:58:28 -06:00
|
|
|
plugins: [
|
|
|
|
commonjs({
|
|
|
|
include: /node_modules/,
|
|
|
|
}),
|
|
|
|
resolve(),
|
2020-05-05 03:39:49 -05:00
|
|
|
image(),
|
2019-02-21 03:58:28 -06:00
|
|
|
env === 'production' && terser(),
|
|
|
|
],
|
|
|
|
};
|
|
|
|
};
|
|
|
|
export default [buildCjsPackage({ env: 'development' }), buildCjsPackage({ env: 'production' })];
|