forked from weijhfly/rolldate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
55 lines (50 loc) · 1.45 KB
/
rollup.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import pkg from './package.json';
import babel from 'rollup-plugin-babel';
import {uglify} from 'rollup-plugin-uglify';
import postcss from 'rollup-plugin-postcss';
import autoprefixer from 'autoprefixer';
import cssnano from 'cssnano';
import banner from 'rollup-plugin-banner';
import merge from 'webpack-merge';
import json from 'rollup-plugin-json';
let year = new Date().getFullYear(),
version = pkg.version;
let bannerText = `Rolldate ${version}
Copyright 2018-${year}
weijhfly https://github.com/weijhfly/rolldate
Licensed under MIT
Released on: aug 4, 2018`;
console.log(bannerText)
let config = {
input: 'src/index.js',
output: {
name: 'Rolldate',
file: 'dist/rolldate.js',
format: 'umd',
},
plugins: [
resolve(),
commonjs(),
json(),
postcss({
plugins: [
autoprefixer({//补全前缀
browsers: ['last 20 versions']
}),
cssnano
],
//extract: 'dist/css/bundle.css' // 输出路径
}),
babel({
exclude: 'node_modules/**', // 排除引入的库
runtimeHelpers: true // 配置runtime,不设置会报错
}),
banner(bannerText),
],
};
let confinMin = merge({}, config);
confinMin.output.file = 'dist/rolldate.min.js';
confinMin.plugins.unshift(uglify());
export default [config, confinMin];