-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
62 lines (59 loc) · 1.64 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
/*
* @Author: your name
* @Date: 2021-07-22 17:28:44
* @LastEditTime: 2021-07-28 09:01:47
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \Electron-Basic-Library\build\rollup.config.dev.js
*/
const path = require('path');
//const fs = require("fs")
import { babel } from '@rollup/plugin-babel'
//import serve from 'rollup-plugin-serve'
// import html from '@rollup/plugin-html'
// import livereload from 'rollup-plugin-livereload'
// import css from 'rollup-plugin-css-only';
import webWorker from "rollup-plugin-web-worker-loader"
import resolve from '@rollup/plugin-node-resolve';
import commonjs from "@rollup/plugin-commonjs"
//import nodePlugins from "rollup-plugin-node-polyfills"
import { terser } from 'rollup-plugin-terser';
import json from "@rollup/plugin-json"
//import { rollup } from 'rollup';
// 返回文件的绝对路径
const resolveFile = function (filename) {
return path.join(__dirname, filename);
}
let plugins = [
json(),
commonjs(),
resolve(),
//nodePlugins
terser(),
webWorker({
targetPlatform: "browser" //转成浏览器支持
}),
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/worker-ws-client.js`),
format: 'umd',
name: `worker-ws-client.js`,
},
plugins
}
module.exports = rollupConfig