-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
43 lines (41 loc) · 1.36 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
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import babel from "rollup-plugin-babel";
import {terser} from 'rollup-plugin-terser';
import {eslint} from 'rollup-plugin-eslint';
import clear from "rollup-plugin-clear";
import json from 'rollup-plugin-json';
const isDev = process.env.NODE_ENV !== 'production';
export default [
{
input: 'lib/index.js',
output: [
{file: 'dist/oauth.cjs.js', format: 'cjs'},
{file: 'dist/oauth.esm.js', format: 'es'},
{name: 'oauth', file: 'dist/oauth.umd.js', format: 'umd'}
],
external: ['js-cookie', 'qs', 'axios'],
watch: {
include: 'src/**'
},
plugins: [
clear({
targets: ["dist"]
}),
eslint({
throwOnError: true,
throwOnWarning: true,
include: ['src/**'],
exclude: ['node_modules/**']
}),
resolve(), // 这样 Rollup 能找到 `ms`
commonjs(), // 这样 Rollup 能转换 `ms` 为一个ES模块
babel({
exclude: [/\/core-js\//,'node_modules/**'],
runtimeHelpers: true, // 使plugin-transform-runtime生效
}),
json(),
!isDev && terser()
]
}
];