grafana/packages/grafana-data/rollup.config.ts

45 lines
1.1 KiB
TypeScript
Raw Normal View History

DevEnv: update frontend dependencies - rollup (#22794) * DevEnv: updates rollup 1.6.0 -> 2.0.6 in grafana-data package * DevEnv: updates rollup 1.6.0 -> 2.0.6 in grafana-e2e package * DevEnv: updates rollup 1.6.0 -> 2.0.6 in grafana-runtime package * DevEnv: updates rollup 1.6.0 -> 2.0.6 in grafana-ui package * DevEnv: updates rollup-plugin-sourcemaps 0.4.2 -> 0.5.0 in grafana-data package * DevEnv: updates rollup-plugin-sourcemaps 0.4.2 -> 0.5.0 in grafana-e2e package * DevEnv: updates rollup-plugin-sourcemaps 0.4.2 -> 0.5.0 in grafana-runtime package * DevEnv: updates rollup-plugin-sourcemaps 0.4.2 -> 0.5.0 in grafana-ui package * DevEnv: updates rollup-plugin-terser 4.0.4 -> 5.3.0 in grafana-data package * DevEnv: updates rollup-plugin-terser 4.0.4 -> 5.3.0 in grafana-e2e package * DevEnv: updates rollup-plugin-terser 4.0.4 -> 5.3.0 in grafana-runtime package * DevEnv: updates rollup-plugin-terser 4.0.4 -> 5.3.0 in grafana-ui package * DevEnv: updates rollup-plugin-typescript2 0.19.3 -> 0.26.0 in grafana-data package * DevEnv: updates rollup-plugin-typescript2 0.19.3 -> 0.26.0 in grafana-e2e package * DevEnv: updates rollup-plugin-typescript2 0.19.3 -> 0.26.0 in grafana-runtime package * DevEnv: updates rollup-plugin-typescript2 0.19.3 -> 0.26.0 in grafana-ui package * DevEnv: updates @rollup/plugin-commonjs 9.2.1 -> 11.0.2 in grafana-data package * DevEnv: updates @rollup/plugin-commonjs 9.2.1 -> 11.0.2 in grafana-e2e package * DevEnv: updates @rollup/plugin-commonjs 9.2.1 -> 11.0.2 in grafana-runtime package * DevEnv: updates @rollup/plugin-commonjs 9.2.1 -> 11.0.2 in grafana-ui package * DevEnv: updates rollup config import in grafana-data package * DevEnv: updates rollup config import in grafana-e2e package * DevEnv: updates rollup config import in grafana-ui package * DevEnv: updates rollup config import in grafana-runtime package * DevEnv: updates @rollup/plugin-node-resolve 4.0.1 -> 7.1.1 in grafana-data package * DevEnv: updates @rollup/plugin-node-resolve 4.0.1 -> 7.1.1 in grafana-e2e package * DevEnv: updates @rollup/plugin-node-resolve 4.0.1 -> 7.1.1 in grafana-runtime package * DevEnv: updates @rollup/plugin-node-resolve 4.0.1 -> 7.1.1 in grafana-ui package * DevEnv: updates lockfile * DevEnv: updates rollup config plugin-node-resolve import in grafana-data package * DevEnv: updates rollup config plugin-node-resolve import in grafana-ui package * DevEnv: updates rollup config plugin-node-resolve import in grafana-e2e package * DevEnv: updates rollup config plugin-node-resolve import in grafana-runtime package * DevEnv: updates rollup-plugin-visualizer 0.9.2 -> 3.3.1 in grafana-data package * DevEnv: updates rollup-plugin-visualizer 0.9.2 -> 3.3.1 in grafana-e2e package * DevEnv: updates rollup-plugin-visualizer 0.9.2 -> 3.3.1 in grafana-runtime package * DevEnv: updates rollup-plugin-visualizer 0.9.2 -> 3.3.1 in grafana-ui package
2020-03-15 10:39:40 -05:00
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import resolve from '@rollup/plugin-node-resolve';
import path from 'path';
import sourceMaps from 'rollup-plugin-sourcemaps';
import { terser } from 'rollup-plugin-terser';
const pkg = require('./package.json');
const libraryName = pkg.name;
const buildCjsPackage = ({ env }) => {
return {
input: `compiled/index.js`,
output: [
{
file: `dist/index.${env}.js`,
name: libraryName,
format: 'cjs',
sourcemap: true,
exports: 'named',
globals: {},
},
],
external: [
'lodash',
'rxjs',
'@grafana/schema', // Load from host
],
plugins: [
resolve(),
json({
include: [path.relative('.', require.resolve('moment-timezone/data/packed/latest.json'))], // absolute path throws an error for whatever reason
}),
commonjs({
include: /node_modules/,
}),
resolve(),
sourceMaps(),
env === 'production' && terser(),
],
};
};
export default [buildCjsPackage({ env: 'development' }), buildCjsPackage({ env: 'production' })];