-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
118 lines (110 loc) · 2.67 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// import {terser} from 'rollup-plugin-terser';
// import replace from '@rollup/plugin-replace';
import babel from "rollup-plugin-babel";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import esformatter from 'rollup-plugin-esformatter';
import json from '@rollup/plugin-json';
import commonjs from '@rollup/plugin-commonjs';
import nodePolyfills from 'rollup-plugin-polyfill-node';
const SRC_DIR = 'src';
const input = [`${SRC_DIR}/index.js`];
const name = 'ZitiBrowzerCore';
// let plugins = [
// babel({
// exclude: "node_modules/**"
// }),
// commonjs(),
// json(),
// nodeResolve({preferBuiltins: false, browser: true}),
// nodePolyfills(),
// esformatter({indent: { value: ' '}}),
// // terser(),
// ];
let plugins = [
commonjs(
{
dynamicRequireTargets: [
// include using a glob pattern (either a string or an array of strings)
// 'node_modules/readable-stream/*.js',
// exclude files that are known to not be required dynamically, this allows for better optimizations
// '!node_modules/logform/index.js',
// '!node_modules/logform/format.js',
// '!node_modules/logform/levels.js',
// '!node_modules/logform/browser.js'
]
}
),
babel({
exclude: "node_modules/**"
}),
json(),
nodeResolve({preferBuiltins: false, browser: true}),
nodePolyfills(),
// esformatter({indent: { value: ' '}}),
// terser(),
];
export default [
//
// IIFE
//
// {
// input,
// output: [
// {
// dir: "dist/iife",
// format: "iife",
// esModule: false,
// name: name,
// exports: "named",
// },
// ],
// external: [
// ...Object.keys(pkg.dependencies || {}),
// ...Object.keys(pkg.peerDependencies || {}),
// ],
// treeshake: true,
// plugins: plugins,
// },
//
// UMD
//
// {
// input,
// output: [
// {
// dir: "dist/umd",
// format: "umd",
// esModule: false,
// name: name,
// exports: "named",
// },
// ],
// external: [
// ...Object.keys(pkg.dependencies || {}),
// ...Object.keys(pkg.peerDependencies || {}),
// ],
// treeshake: true,
// plugins: plugins,
// },
//
// ESM and CJS
//
{
input,
treeshake: true,
// plugins: plugins.concat(nodeResolve({preferBuiltins: false, browser: true}), esformatter({indent: { value: ' '}})),
plugins: plugins,
output: [
{
dir: "dist/esm",
format: "esm",
exports: "named",
},
// {
// dir: "dist/cjs",
// format: "cjs",
// exports: "named",
// },
],
},
];