mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Build: add @grafana/data package (#17436)
first step in moving non-ui components to their own package
This commit is contained in:
50
packages/grafana-data/rollup.config.ts
Normal file
50
packages/grafana-data/rollup.config.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
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'], // Use Lodash from grafana
|
||||
plugins: [
|
||||
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' })];
|
||||
Reference in New Issue
Block a user