-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
42 lines (38 loc) · 1.06 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
import typescript from "rollup-plugin-typescript2";
import sourceMaps from "rollup-plugin-sourcemaps";
import resolve from "rollup-plugin-node-resolve";
import { sizeSnapshot } from "rollup-plugin-size-snapshot";
function createConfig(pkg) {
const input = `packages/${pkg}/src/index.ts`;
const output = `packages/${pkg}/dist/index`;
const tsconfig = `packages/${pkg}/tsconfig.json`;
return [
{
input: input,
output: [
{ file: `${output}.esm.js`, format: `esm`, sourcemap: true },
{ file: `${output}.cjs.js`, format: `cjs`, sourcemap: true }
],
external: ["react", "preact"],
plugins: [
typescript({
tsconfig: `${tsconfig}`,
tsconfigOverride: {
compilerOptions: {
target: "esnext"
}
}
}),
resolve(),
sourceMaps(),
sizeSnapshot()
]
}
];
}
const config = [
...createConfig("core-tiny-spring"),
...createConfig("react-tiny-spring"),
...createConfig("preact-tiny-spring")
];
export default config;