rollup.config.js 873 字节
Newer Older
C
chomik 已提交
1
'use strict';
C
chomik 已提交
2

C
chomik 已提交
3
const BUNDLE = process.env.BUNDLE === 'true';
C
chomik 已提交
4

C
codecalm 已提交
5 6 7 8
import path from 'path';
import babel from 'rollup-plugin-babel';
import resolve from 'rollup-plugin-node-resolve';
import minify from 'rollup-plugin-babel-minify';
C
chomik 已提交
9

C
codecalm 已提交
10 11 12 13 14 15 16

const fileDest = 'tabler',
  banner = require('./banner');

let plugins = [
  resolve()
];
C
chomik 已提交
17 18

if (BUNDLE) {
C
codecalm 已提交
19 20 21 22 23 24 25 26
  plugins = [plugins, ...[
    babel({
      exclude: 'node_modules/**'
    }),
    minify({
      comments: false
    })
  ]];
C
chomik 已提交
27 28
}

C
codecalm 已提交
29 30 31 32 33 34
module.exports = {
  input: {
    tabler: path.resolve(__dirname, '../js/tabler.js'),
    'tabler-charts': path.resolve(__dirname, '../js/tabler-charts.js'),
    demo: path.resolve(__dirname, '../js/demo.js')
  },
C
chomik 已提交
35 36
  output: {
    banner,
C
codecalm 已提交
37 38 39 40
    // name: 'tabler',
    dir: path.resolve(__dirname, `../dist/js/`),
    entryFileNames: BUNDLE ? '[name].min.js' : '[name].js',
    format: 'cjs'
C
chomik 已提交
41
  },
D
Damian Sznajder 已提交
42
  plugins,
C
chomik 已提交
43
};