forked from luozheao/setHost
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
47 lines (45 loc) · 1.37 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
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import babel from 'rollup-plugin-babel';
import json from 'rollup-plugin-json';
import { uglify } from 'rollup-plugin-uglify';
import builtins from 'rollup-plugin-node-builtins';
// import typescript from 'rollup-plugin-typescript';
import globals from 'rollup-plugin-node-globals'
const path = require('path')
export default {
input: path.join(process.cwd(), 'getHost/gitHost.js'), //入口
plugins: [
resolve({
preferBuiltins: true
}), // 是否打包进来
commonjs(), // cmd转esm
json(),
babel({
runtimeHelpers: true,
exclude: path.join(process.cwd(), 'node_modules/**'),
plugins: [],
}),
// globals(),
// builtins(), //把node环境的api也打包进来了.
// typescript(),
uglify(),
],
external: [
// 'axios' //外部引用
],
// onwarn(warn) {
// if (warn.code == 'MISSING_GLOBAL_NAME') {
// return
// }
// console.log(warn);
// },
output: {
globals: {
axios: 'axios', // 外部引用插件,指定对应全局变量的名称
},
name: 'getHost',
format: 'umd',// 'cjs',
file: path.join(process.cwd(), 'getHost/bundle.js')
}
}