2020-03-15 16:39:40 +01:00
|
|
|
import resolve from '@rollup/plugin-node-resolve';
|
|
|
|
|
import commonjs from '@rollup/plugin-commonjs';
|
2020-05-05 10:39:49 +02:00
|
|
|
import image from '@rollup/plugin-image';
|
2019-02-21 10:58:28 +01: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 09:22:09 +02:00
|
|
|
dir: 'dist',
|
2019-02-21 10:58:28 +01:00
|
|
|
name: libraryName,
|
|
|
|
|
format: 'cjs',
|
|
|
|
|
sourcemap: true,
|
2020-01-03 10:02:27 +01:00
|
|
|
strict: false,
|
2019-02-21 10:58:28 +01:00
|
|
|
exports: 'named',
|
2020-06-30 09:22:09 +02:00
|
|
|
chunkFileNames: `[name].${env}.js`,
|
2019-02-21 10:58:28 +01:00
|
|
|
globals: {
|
|
|
|
|
react: 'React',
|
|
|
|
|
'prop-types': 'PropTypes',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
2020-06-29 10:58:47 -07:00
|
|
|
external: [
|
|
|
|
|
'react',
|
|
|
|
|
'react-dom',
|
2021-03-30 12:30:34 +02:00
|
|
|
'@grafana/aws-sdk',
|
2020-06-29 10:58:47 -07: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 16:43:57 +08:00
|
|
|
'jquery', // required to use jquery.plot, which is assigned externally
|
2020-06-29 10:58:47 -07:00
|
|
|
],
|
2019-02-21 10:58:28 +01:00
|
|
|
plugins: [
|
|
|
|
|
commonjs({
|
|
|
|
|
include: /node_modules/,
|
|
|
|
|
}),
|
|
|
|
|
resolve(),
|
2020-05-05 10:39:49 +02:00
|
|
|
image(),
|
2019-02-21 10:58:28 +01:00
|
|
|
env === 'production' && terser(),
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
export default [buildCjsPackage({ env: 'development' }), buildCjsPackage({ env: 'production' })];
|