Skip to content

Commit

Permalink
Fixed production build for UMD (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
w8r authored Mar 28, 2024
1 parent 5db0b40 commit aab44b7
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 5.0.2
current_version = 5.0.3
commit = False
tag = False
serialize =
Expand Down
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.2
5.0.3
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@linkurious/ogma-react",
"version": "5.0.2",
"version": "5.0.3",
"description": "A light adaptation of Ogma for React application",
"keywords": [
"ogma",
Expand All @@ -9,15 +9,15 @@
"webgl",
"graph"
],
"jsdelivr": "dist/ogma-react.mjs",
"browser": "dist/ogma-react.umd.js",
"main": "dist/ogma-react.mjs",
"module": "dist/ogma-react.mjs",
"jsdelivr": "dist/index.mjs",
"browser": "dist/index.umd.js",
"main": "dist/index.mjs",
"module": "dist/index.mjs",
"typings": "dist/index.d.ts",
"exports": {
"import": "./dist/ogma-react.mjs",
"require": "./dist/ogma-react.js",
"default": "./dist/ogma-react.mjs",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"default": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"files": [
Expand Down
4 changes: 2 additions & 2 deletions src/overlay/overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { useOgma } from "../context";
import { getPosition } from "./utils";
import { createPortal } from "react-dom";

interface PopupProps {
interface OverlayProps {
/** Overlay position */
position: Point | ((ogma: OgmaLib) => Point | null);
/** Overlay size */
Expand All @@ -33,7 +33,7 @@ const offScreenPos: Point = { x: -9999, y: -9999 };
// TODO: use props for these classes
export const Overlay = forwardRef(
(
{ position, children, className = "", size, scaled }: PopupProps,
{ position, children, className = "", size, scaled }: OverlayProps,
ref?: Ref<OverlayLayer>
) => {
const ogma = useOgma();
Expand Down
16 changes: 4 additions & 12 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,8 @@
"skipLibCheck": true,
"jsx": "react-jsx",
"outDir": "./dist/",
"types": [
"node",
"jest"
],
"lib": [
"ES6",
"DOM"
]
"types": ["node", "jest"],
"lib": ["ES6", "DOM"]
},
"include": [
"src/**/*.ts",
Expand All @@ -37,7 +31,5 @@
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}
"exclude": ["node_modules"]
}
7 changes: 7 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@ import react from "@vitejs/plugin-react";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
define: { "process.env": { NODE_ENV: "production" } },
build: {
minify: true,
sourcemap: true,
lib: {
name: "OgmaReact",
entry: "./src/index.ts",
formats: ["es", "cjs", "umd"],
fileName: (format) => {
if (format === "umd") return `index.umd.js`;
if (format === "cjs") return `index.cjs`;
return `index.mjs`;
},
},
rollupOptions: {
external: ["@linkurious/ogma", "react", "react-dom", "react-dom/server"],
Expand Down

0 comments on commit aab44b7

Please sign in to comment.