Skip to content

Commit

Permalink
feat(lib): add rollup config
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-suwala committed Sep 25, 2023
1 parent 0ddb61c commit b8a9fa8
Show file tree
Hide file tree
Showing 3 changed files with 208 additions and 2 deletions.
7 changes: 7 additions & 0 deletions lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
"version": "1.0.0",
"description": "PubNub JavaScript Chat SDK",
"main": "dist/index.js",
"module": "dist/index.es.js",
"types": "dist/index.d.ts",
"react-native": "dist/index.es.js",
"scripts": {
"test": "jest",
"build": "tsc",
"build-rollup": "rollup -c",
"dev": "tsc -w"
},
"repository": {
Expand All @@ -24,12 +27,16 @@
"@babel/core": "7.22.15",
"@babel/preset-env": "7.22.5",
"@babel/preset-typescript": "7.22.5",
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-terser": "^0.4.3",
"@types/jest": "29.5.0",
"@types/pubnub": "7.2.0",
"babel-jest": "29.5.0",
"dotenv": "16.0.3",
"jest": "29.5.0",
"jest-junit": "16.0.0",
"rollup": "^3.29.2",
"rollup-plugin-ts": "^3.4.5",
"typescript": "4.9.5"
}
}
29 changes: 29 additions & 0 deletions lib/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import pkg from "./package.json" assert { type: 'json' };
import replace from "@rollup/plugin-replace"
import ts from "rollup-plugin-ts"
import terser from '@rollup/plugin-terser';

export default [
{
input: "./src/index.ts",
external: ["pubnub"],
output: [
{
file: pkg.main,
format: "cjs",
},
{
file: pkg.module,
format: "esm",
},
],
plugins: [
replace({
preventAssignment: true,
__PLATFORM__: "RCC",
__VERSION__: pkg.version,
}),
ts(),
terser(),
],
}]
Loading

0 comments on commit b8a9fa8

Please sign in to comment.