This repository has been archived by the owner on Jun 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
rollup.config.js
80 lines (78 loc) · 1.97 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* ***************************************************************************
*
* Copyright (c) 2021, the iexjs authors.
*
* This file is part of the iexjs library, distributed under the terms of
* the Apache License 2.0. The full license can be found in the LICENSE file.
*
*/
import babel from "@rollup/plugin-babel";
import filesize from "rollup-plugin-filesize";
import json from "@rollup/plugin-json";
import sourcemaps from "rollup-plugin-sourcemaps";
import { terser } from "rollup-plugin-terser";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import globals from "rollup-plugin-node-globals";
import nodePolyfills from "rollup-plugin-node-polyfills";
import inject from "@rollup/plugin-inject";
import injectProcessEnv from "rollup-plugin-inject-process-env";
import pkg from "./package.json";
export default () => [
{
input: "src/js/index.js",
output: {
sourcemap: true,
file: pkg.module,
name: "iexjs",
format: "esm",
},
plugins: [
nodeResolve({ browser: true }),
commonjs(),
babel({
exclude: "node_modules/**",
babelHelpers: "bundled",
}),
nodePolyfills(),
globals(),
filesize(),
json(),
injectProcessEnv({
IEX_TOKEN: "",
}),
terser(),
sourcemaps(),
],
watch: {
clearScreen: false,
},
},
{
input: "src/js/index.js",
output: {
sourcemap: true,
format: "cjs",
file: "dist/cjs/iexjs.js",
},
plugins: [
inject({
EventSource: "eventsource", // inject for node
fetch: "cross-fetch", // inject for node
include: "**/*.js",
}),
nodeResolve({ browser: false, preferBuiltins: true }),
commonjs(),
babel({
exclude: "node_modules/**",
babelHelpers: "bundled",
}),
json(),
globals(),
sourcemaps(),
],
watch: {
clearScreen: false,
},
},
];