-
Notifications
You must be signed in to change notification settings - Fork 90
/
rollup.config.mjs
69 lines (68 loc) · 3.27 KB
/
rollup.config.mjs
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
import resolve from "@rollup/plugin-node-resolve";
import json from "@rollup/plugin-json";
import commonjs from "@rollup/plugin-commonjs";
import typescript from "rollup-plugin-typescript2";
import external from "rollup-plugin-peer-deps-external";
import { visualizer } from "rollup-plugin-visualizer";
import importCssString from "./other/rollup-plugin-css-string-import.mjs";
export default [
// CommonJS (for Node) and ES module (for bundlers) build.
// (We could have three entries in the configuration array
// instead of two, but it's quicker to generate multiple
// builds from a single configuration where possible, using
// an array for the `output` option, where we can specify
// `file` and `format` for each target)
{
input: {
index: "lib/ts/index.ts",
"ui-entry": "lib/ts/ui/index.tsx",
session: "lib/ts/recipe/session/index.ts",
sessionprebuiltui: "lib/ts/recipe/session/prebuiltui.tsx",
emailverification: "lib/ts/recipe/emailverification/index.ts",
emailverificationprebuiltui: "lib/ts/recipe/emailverification/prebuiltui.tsx",
emailpassword: "lib/ts/recipe/emailpassword/index.ts",
emailpasswordprebuiltui: "lib/ts/recipe/emailpassword/prebuiltui.tsx",
passwordless: "lib/ts/recipe/passwordless/index.ts",
passwordlessprebuiltui: "lib/ts/recipe/passwordless/prebuiltui.tsx",
thirdparty: "lib/ts/recipe/thirdparty/index.ts",
thirdpartyprebuiltui: "lib/ts/recipe/thirdparty/prebuiltui.tsx",
thirdpartyemailpassword: "lib/ts/recipe/thirdpartyemailpassword/index.ts",
thirdpartyemailpasswordprebuiltui: "lib/ts/recipe/thirdpartyemailpassword/prebuiltui.tsx",
thirdpartypasswordless: "lib/ts/recipe/thirdpartypasswordless/index.ts",
thirdpartypasswordlessprebuiltui: "lib/ts/recipe/thirdpartypasswordless/prebuiltui.tsx",
multitenancy: "lib/ts/recipe/multitenancy/index.ts",
multifactorauth: "lib/ts/recipe/multifactorauth/index.ts",
multifactorauthprebuiltui: "lib/ts/recipe/multifactorauth/prebuiltui.tsx",
totp: "lib/ts/recipe/totp/index.ts",
totpprebuiltui: "lib/ts/recipe/totp/prebuiltui.tsx",
userroles: "lib/ts/recipe/userroles/index.ts",
},
plugins: [
external(),
resolve(),
json(),
commonjs({
defaultIsModuleExports: "auto",
}),
typescript({ tsconfig: "./lib/tsconfig.json" }), // so Rollup can convert TypeScript to JavaScript
importCssString(),
visualizer(),
],
output: [
{
dir: "lib/build",
format: "commonjs",
interop: "auto",
sourcemap: false,
chunkFileNames: (chunkInfo) => {
const root = chunkInfo.moduleIds[chunkInfo.moduleIds.length - 1];
const recipeMatch = root.match(/\/lib\/ts\/recipe\/(\w+)\/\w+.tsx?/);
if (recipeMatch) {
return recipeMatch[1] + "-shared.js";
}
return chunkInfo.name + ".js";
},
},
],
},
];