js-waku/packages/react/rollup.config.js
Sasha ad0bed69ba
feat: add waku/react package and make it compatible with React frameworks (#2656)
* chore: add waku/react package

* fix check

* remove not needed logic from waku/react package

* make it compatible with expo/next

* add to release please

* remove tests
2025-10-08 15:37:49 +02:00

100 lines
1.9 KiB
JavaScript

import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import terser from "@rollup/plugin-terser";
import typescript from "rollup-plugin-typescript2";
const input = "src/index.ts";
const external = [
"react",
"react-dom",
"@waku/interfaces",
"@waku/sdk",
"@waku/utils"
];
export default [
{
input,
output: {
file: "dist/index.esm.mjs",
format: "esm",
sourcemap: true
},
external,
plugins: [
nodeResolve({
browser: true,
preferBuiltins: false
}),
commonjs(),
json(),
typescript({
tsconfig: "./tsconfig.json",
useTsconfigDeclarationDir: true
})
]
},
{
input,
output: {
file: "dist/index.cjs.js",
format: "cjs",
sourcemap: true,
exports: "named"
},
external,
plugins: [
nodeResolve({
browser: true,
preferBuiltins: false
}),
commonjs(),
json(),
typescript({
tsconfig: "./tsconfig.json",
tsconfigOverride: {
compilerOptions: {
declaration: false
}
}
})
]
},
{
input,
output: {
file: "dist/index.umd.js",
format: "umd",
name: "WakuReact",
sourcemap: true,
globals: {
react: "React",
"react-dom": "ReactDOM",
"@waku/interfaces": "WakuInterfaces",
"@waku/sdk": "WakuSDK",
"@waku/utils": "WakuUtils"
}
},
external,
plugins: [
nodeResolve({
browser: true,
preferBuiltins: false
}),
commonjs(),
json(),
typescript({
tsconfig: "./tsconfig.json",
tsconfigOverride: {
compilerOptions: {
declaration: false
}
}
}),
terser()
]
}
];