-
Notifications
You must be signed in to change notification settings - Fork 96
/
rollup.config.js
79 lines (75 loc) · 2.18 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// import resolve from 'rollup-plugin-node-resolve'
// import babel from 'rollup-plugin-babel'
// import json from 'rollup-plugin-json'
// import commonjs from 'rollup-plugin-commonjs'
// import replace from 'rollup-plugin-replace'
import {eslint} from 'rollup-plugin-eslint'
// import {uglify} from 'rollup-plugin-uglify'
// 配置服务
// import liveServer from 'rollup-plugin-live-server'
import copy from 'rollup-plugin-copy'
// var path = require('path');
// const mode = process.env.NODE_ENV
// const isWatch = process.env.ROLLUP_WATCH
// const zip = require('rollup-plugin-zip')
// console.log('执行环境:', mode)
// const isProd = mode === 'production'
export default {
input: 'src/lib/luch-request.js',
output: {
file: 'dist/index.js',
format: 'umd',
name: 'LuChRequest',
globals: {},
sourcemap: true
},
external: [],
plugins: [
// json(),
eslint(),
// replace({
// 'process.env.NODE_ENV': JSON.stringify(mode)
// }),
// resolve(),
// babel({
// runtimeHelpers: true,
// exclude : ['node_modules/**']
// }),
// commonjs(),
// isWatch && liveServer({
// port: 3000,
// root: 'test',
// file: 'index.html',
// open: false,
// wait: 500
// }),
// isProd && uglify({
// // comments: ['all'],
// output: {
// // 最紧凑的输出
// // beautify: false,
// // 删除所有的注释
// // comments: ['all'],
// },
// warnings: false,
// compress: {
// // comments: ['all'],
// pure_getters: true,
// unsafe: true,
// unsafe_comps: true,
// }
// })
copy({
targets: [
{src: ['src/lib/utils.js', 'src/lib/core', 'src/lib/helpers', 'src/lib/utils', 'src/lib/adapters'], dest: 'DCloud/luch-request'},
{src: 'src/lib/luch-request.js', dest: 'DCloud/luch-request', rename: 'index.js'},
{src: 'src/lib/luch-request.d.ts', dest: 'DCloud/luch-request', rename: 'index.d.ts'},
{src: ['example/request-demo'], dest: 'DCloud/'},
]
}),
// zip({
// file: 'DCloud/luch-request.zip',
// dir: './DCloud/luch-request'
// })
]
}