forked from mayteio/use-pusher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
76 lines (73 loc) · 1.78 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
import typescript from "rollup-plugin-typescript2";
import commonjs from "rollup-plugin-commonjs";
import external from "rollup-plugin-peer-deps-external";
import resolve from "rollup-plugin-node-resolve";
import url from "rollup-plugin-url";
import babel from "rollup-plugin-babel";
import ts from "@wessberg/rollup-plugin-ts";
import pkg from "./package.json";
const plugins = [
external(),
url({ exclude: ["**/*.svg"] }),
resolve(),
ts(),
// typescript({
// rollupCommonJSResolveHack: true,
// clean: true,
// exclude: ["./src/__tests__/*"],
// }),
// babel({
// extensions: [".tsx"],
// exclude: ["node_modules/**", "./src/__tests__"],
// presets: ["@babel/env", "@babel/preset-react"],
// }),
commonjs(),
];
export default [
{
input: "src/web/index.ts",
external: ["pusher-js"],
plugins,
output: [
{
file: pkg.main,
format: "cjs",
exports: "named",
sourcemap: true,
},
{
file: pkg.module,
format: "es",
exports: "named",
sourcemap: true,
},
{
// build into our example app for testing with a real client
file: "examples/web/src/use-pusher/index.js",
format: "es",
exports: "named",
sourcemap: true,
},
],
},
{
input: "src/native/index.ts",
external: ["pusher-js", "react-native"],
plugins,
output: [
{
// allows users to import from @harelpls/use-pusher/react-native
file: "react-native/index.js",
format: "cjs",
exports: "named",
sourcemap: true,
},
{
file: "examples/native-use-pusher-example/use-pusher/native/index.js",
format: "cjs",
exports: "named",
sourcemap: true,
},
],
},
];