This repository was archived by the owner on Aug 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathrollup.config.js
More file actions
74 lines (71 loc) · 2.04 KB
/
rollup.config.js
File metadata and controls
74 lines (71 loc) · 2.04 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
import path from "node:path"
import alias from "@rollup/plugin-alias"
import json from "@rollup/plugin-json"
import typescript from "@rollup/plugin-typescript"
import autoprefixer from "autoprefixer"
import atImport from "postcss-import"
import postcss from "rollup-plugin-postcss"
import tailwindcss from "tailwindcss"
import packageJson from "./package.json" with { type: "json" }
import radixSelectPackageJson from "./src/lib/@radix-ui/react-select/package.json" with {
type: "json",
}
const config = [
{
input: ["src/index.ts", "src/config.ts", "src/types.ts", "src/utils.ts"],
output: [
{
dir: "dist",
format: "es",
sourcemap: true,
preserveModules: true,
preserveModulesRoot: "src",
entryFileNames: "[name].js",
},
],
plugins: [
alias({
entries: [
{
find: "@radix-ui/react-select",
replacement: path.resolve(
import.meta.dirname,
"src/lib/@radix-ui/react-select"
),
},
],
}),
typescript({
tsconfig: "./tsconfig.json",
declaration: false,
declarationMap: false,
outputToFilesystem: true,
}),
json(),
postcss({
extensions: [".css"],
inject: false,
extract: false,
modules: false,
minimize: false,
plugins: [atImport, tailwindcss, autoprefixer],
}),
],
external: [
...Object.keys(packageJson.dependencies).filter(
// "@radix-ui/react-select" is monkey-patched, so we need to include it in the bundle
(pkg) => pkg !== "@radix-ui/react-select"
),
...Object.keys(radixSelectPackageJson.dependencies),
// Subfolders are not excluded by default
"zustand/vanilla",
"zustand/middleware",
"react/jsx-runtime", // Implicitly required by React JSX transform
"@noble/curves/secp256k1",
"@noble/hashes/sha3",
"@noble/hashes/sha256",
"near-api-js/lib/providers",
],
},
]
export default config