-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
50 lines (48 loc) · 1.21 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
/*
* @Author: your name
* @Date: 2021-07-22 17:28:44
* @LastEditTime: 2021-07-27 19:51:31
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \Electron-Basic-Library\build\rollup.config.dev.js
*/
const path = require('path');
import { babel } from '@rollup/plugin-babel'
import resolve from '@rollup/plugin-node-resolve';
import commonjs from "@rollup/plugin-commonjs"
import { terser } from 'rollup-plugin-terser';
import json from "@rollup/plugin-json"
// 返回文件的绝对路径
const resolveFile = function (filename) {
return path.join(__dirname, filename);
}
let plugins = [
json(),
commonjs(),
resolve(),
//nodePlugins
terser(),
babel(
{
babelrc: false,
include: ['src/**/*'],
exclude: 'node_modules/**',
presets: [['@babel/preset-env', {
"modules": false,
}]],
plugins: [["@babel/transform-runtime", { regenerator: true }]],
babelHelpers: 'runtime',
extensions: ['js', 'ts'],
}
)
];
const rollupConfig = {
input: resolveFile("src/index.js"),
output: {
file: resolveFile(`dist/node-tcp-client.cjs`),
format: 'cjs',
name: `index.umd.js`,
},
plugins
}
module.exports = rollupConfig