mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 20:24:18 -06:00
55 lines
1.4 KiB
TypeScript
55 lines
1.4 KiB
TypeScript
import resolve from '@rollup/plugin-node-resolve';
|
|
import commonjs from '@rollup/plugin-commonjs';
|
|
import sourceMaps from 'rollup-plugin-sourcemaps';
|
|
import json from '@rollup/plugin-json';
|
|
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', 'apache-arrow'], // Use Lodash, rxjs & arrow from grafana
|
|
plugins: [
|
|
json({
|
|
include: ['../../node_modules/moment-timezone/data/packed/latest.json'],
|
|
}),
|
|
commonjs({
|
|
include: /node_modules/,
|
|
namedExports: {
|
|
'../../node_modules/lodash/lodash.js': [
|
|
'flatten',
|
|
'find',
|
|
'upperFirst',
|
|
'debounce',
|
|
'isNil',
|
|
'isNumber',
|
|
'flattenDeep',
|
|
'map',
|
|
'chunk',
|
|
'sortBy',
|
|
'uniqueId',
|
|
'zip',
|
|
],
|
|
},
|
|
}),
|
|
resolve(),
|
|
sourceMaps(),
|
|
env === 'production' && terser(),
|
|
],
|
|
};
|
|
};
|
|
export default [buildCjsPackage({ env: 'development' }), buildCjsPackage({ env: 'production' })];
|