From 826c968ef81bf2730611d432e3402bbd0b594458 Mon Sep 17 00:00:00 2001 From: "ildar.timerbaev" Date: Tue, 28 May 2024 14:45:37 +0600 Subject: [PATCH] Updated build for nextJS --- lib/api/ecency-api/get-public-keys-query.ts | 6 +++--- lib/nostr/nostr-provider.tsx | 2 +- package.json | 9 ++++++++- vite.config.js | 4 +++- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/api/ecency-api/get-public-keys-query.ts b/lib/api/ecency-api/get-public-keys-query.ts index c106882..c88c837 100644 --- a/lib/api/ecency-api/get-public-keys-query.ts +++ b/lib/api/ecency-api/get-public-keys-query.ts @@ -1,7 +1,7 @@ -import { useQuery } from "@tanstack/react-query"; +import {useQuery} from "@tanstack/react-query"; import axios from "axios"; -import { useContext } from "react"; -import { ChatContext } from "../../chat-context-provider"; +import {useContext} from "react"; +import {ChatContext} from "../../chat-context-provider"; export function useGetPublicKeysQuery(username?: string) { const { privateApiHost } = useContext(ChatContext); diff --git a/lib/nostr/nostr-provider.tsx b/lib/nostr/nostr-provider.tsx index 4f8188f..296a7d9 100644 --- a/lib/nostr/nostr-provider.tsx +++ b/lib/nostr/nostr-provider.tsx @@ -4,7 +4,7 @@ import { NostrContext } from "./nostr-context"; export const RELAYS: Record = { "wss://none.ecency.com": { read: true, write: true }, - "wss://ntwo.ecency.com": { read: true, write: true } + "wss://ntwo.ecency.com": { read: true, write: true }, }; export function NostrProvider({ children }: PropsWithChildren) { diff --git a/package.json b/package.json index 256be45..9df890d 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,14 @@ "repository": "https://github.com/ecency/ns-query", "author": "ildar.timerbaev ", "license": "MIT", - "main": "dist/index.js", + "main": "index.js", + "module": "dist/index.esm.js", + "exports": { + ".": { + "import": "./dist/index.esm.js", + "require": "./dist/index.js" + } + }, "types": "dist/index.d.ts", "files": [ "/dist" diff --git a/vite.config.js b/vite.config.js index 9f85b7f..1fcbd9b 100644 --- a/vite.config.js +++ b/vite.config.js @@ -8,11 +8,13 @@ import react from "@vitejs/plugin-react"; export default defineConfig({ build: { target: ["es2015"], + sourcemap: true, + minify: false, lib: { entry: resolve(__dirname, "lib/index.ts"), name: "dist", fileName: "index", - formats: ["cjs"], + formats: ["esm", "cjs"], }, rollupOptions: { external: [