-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrollup.config.mjs
More file actions
85 lines (82 loc) · 2.17 KB
/
rollup.config.mjs
File metadata and controls
85 lines (82 loc) · 2.17 KB
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
import typescript from '@rollup/plugin-typescript';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import replace from '@rollup/plugin-replace';
import terser from '@rollup/plugin-terser';
const input = 'src/index.ts';
const umdInput = 'src/umd.ts';
const banner = '/*! ostrio-analytics v2.0.0 | BSD-3-Clause */';
const basePlugins = [
resolve({ browser: true, preferBuiltins: false }),
commonjs(),
replace({
preventAssignment: true,
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production')
})
];
export default [{
input,
output: { file: 'dist/index.js', format: 'esm', sourcemap: true, banner },
plugins: [
...basePlugins,
typescript({ compilerOptions: { target: 'ES2022', module: 'ESNext' } })
// esbuild({ target: 'es2022', platform: 'browser', sourceMap: true, minify: false })
],
treeshake: true
}, {
input,
output: { file: 'dist/index.cjs', format: 'cjs', exports: 'named', sourcemap: true, banner },
plugins: [
...basePlugins,
typescript({ compilerOptions: { target: 'ES2020', module: 'ESNext' } })
// esbuild({ target: 'es2020', platform: 'browser', sourceMap: true, minify: false })
],
treeshake: true
}, {
input: umdInput,
output: {
file: 'dist/ostrio-analytics.umd.js',
format: 'umd',
name: 'OstrioTrackerClass',
exports: 'default',
sourcemap: true,
banner
},
plugins: [
...basePlugins,
typescript({
compilerOptions: {
target: 'ES5',
module: 'ESNext',
lib: ['DOM', 'ES5', 'ES2015.Iterable'],
downlevelIteration: true,
importHelpers: true
}
})
],
treeshake: true
}, {
input: umdInput,
output: {
file: 'dist/ostrio-analytics.min.js',
format: 'umd',
name: 'OstrioTrackerClass',
exports: 'default',
sourcemap: true,
banner
},
plugins: [
...basePlugins,
typescript({
compilerOptions: {
target: 'ES5',
module: 'ESNext',
lib: ['DOM', 'ES5', 'ES2015.Iterable'],
downlevelIteration: true,
importHelpers: true
}
}),
terser({ format: { comments: /^!/ } })
],
treeshake: true
}];