-
Notifications
You must be signed in to change notification settings - Fork 5
/
rollup.config.js
41 lines (37 loc) · 1.11 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
const exclude = require('rollup-plugin-exclude-dependencies-from-bundle');
const alias = require('@rollup/plugin-alias').default;
const resolve = require('@rollup/plugin-node-resolve').default;
const commonjs = require('@rollup/plugin-commonjs').default;
const cleanup = require('rollup-plugin-cleanup');
const dts = require('rollup-plugin-dts').default;
const E = process.env;
const entries = !/web/i.test(E.TYPE)? [] : [
{find: './_http', replacement: './_http.web'},
{find: './_websocket', replacement: './_websocket.web'},
];
const skip = ["ws"];
module.exports = [{
input: ".build/index.d.ts",
output: {
file: "index.d.ts",
format: "es",
exports: "auto"
},
plugins: [dts()]
}, {
input: ".build/index.js",
output: {
file: "index.js",
format: "cjs",
exports: "auto"
},
plugins: [exclude(), alias({entries}), resolve(), commonjs(), cleanup({comments: "none"})]
}, {
input: ".build/index.js",
output: {
file: "index.mjs",
format: "es",
exports: "auto"
},
plugins: [exclude(), alias({entries}), resolve(), commonjs(), cleanup({comments: "none"})]
}];