-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup.config.js
104 lines (102 loc) · 2.28 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
import { swc } from "rollup-plugin-swc3";
import { dts } from "rollup-plugin-dts";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import { terser } from "rollup-plugin-terser";
import nodePolyfills from 'rollup-plugin-polyfill-node';
import bakedEnv from 'rollup-plugin-baked-env';
import pkg from './package.json';
const name = 'lottie-player';
const globals = {
url: "url",
lit: "lit",
uuid: "uuid",
"lit/decorators.js": "lit/decorators.js",
};
export default [
{
input: "./src/lottie-player.ts",
treeshake: {
moduleSideEffects: false,
propertyReadSideEffects: false,
tryCatchDeoptimization: false
},
output: [
{
file: './dist/lottie-player.js',
format: "umd",
name,
minifyInternalExports: true,
inlineDynamicImports: true,
sourcemap: true,
globals,
hoistTransitiveImports: true,
},
{
file: pkg.main,
name,
format: "cjs",
minifyInternalExports: true,
inlineDynamicImports: true,
sourcemap: true,
globals,
},
{
file: pkg.module,
format: "esm",
name,
inlineDynamicImports: true,
sourcemap: true,
globals,
},
],
plugins: [
bakedEnv({ THORVG_VERSION: process.env.THORVG_VERSION }),
nodePolyfills(),
commonjs({
include: /node_modules/
}),
swc({
include: /\.[mc]?[jt]sx?$/,
exclude: /node_modules/,
tsconfig: "tsconfig.json",
jsc: {
parser: {
syntax: "typescript",
tsx: false,
decorators: true,
declaration: true,
dynamicImport: true,
},
target: "esnext",
},
}),
nodeResolve(),
terser({
compress: {
pure_getters: true,
passes: 3,
drop_console: true,
drop_debugger: true
},
mangle: true,
output: {
comments: false,
},
}),
],
},
{
input: "./src/lottie-player.ts",
treeshake: true,
output: [
{
file: './dist/lottie-player.d.ts',
format: "esm",
}
],
plugins: [
dts(),
],
}
];