From bf6e29365e4b550728d9e36ca1b343e7e747ec8d Mon Sep 17 00:00:00 2001 From: Daniel Kostro Date: Wed, 18 Oct 2023 15:58:57 +0200 Subject: [PATCH] fix: build esm, not cjs (#2712) * chore: remove unused tsconfig file file * chore: fix type issue with clipboard item data --- src/utils/clipboard/clipboard.ts | 4 +++- src/utils/clipboard/clipboardHooks.ts | 4 +--- tsconfig.cjs.json | 9 --------- tsconfig.json | 4 ++-- 4 files changed, 6 insertions(+), 15 deletions(-) delete mode 100644 tsconfig.cjs.json diff --git a/src/utils/clipboard/clipboard.ts b/src/utils/clipboard/clipboard.ts index a4df1271c3..a5a0912efe 100644 --- a/src/utils/clipboard/clipboard.ts +++ b/src/utils/clipboard/clipboard.ts @@ -1,3 +1,5 @@ +import type { ClipboardItemDataType } from 'clipboard-polyfill'; + export function readText(): Promise { return import('clipboard-polyfill').then((c) => c.readText()); } @@ -22,7 +24,7 @@ export function write(data: ClipboardItemInterface[]): Promise { } export function newClipboardItem( - items: Record>, + items: Record, options?: ClipboardItemOptions, ): Promise { return import('clipboard-polyfill').then( diff --git a/src/utils/clipboard/clipboardHooks.ts b/src/utils/clipboard/clipboardHooks.ts index 067f494e84..0d9ca7db85 100644 --- a/src/utils/clipboard/clipboardHooks.ts +++ b/src/utils/clipboard/clipboardHooks.ts @@ -199,9 +199,7 @@ export function useClipboard(): UseClipboardReturn { async rawWriteWithType(data: string, type = 'text/plain') { try { const item = await newClipboardItem({ - [type]: new Promise((resolve) => { - resolve(new Blob([data], { type })); - }), + [type]: new Blob([data], { type }), }); return await write([item]); } catch { diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json deleted file mode 100644 index 9e585759ea..0000000000 --- a/tsconfig.cjs.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.esm.json", - "compilerOptions": { - "outDir": "lib-cjs", - "noEmit": false, - "module": "CommonJS", - "declaration": false - } -} diff --git a/tsconfig.json b/tsconfig.json index 6f1f87693c..a0ddff7d91 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,8 +11,8 @@ "noImplicitAny": false, "forceConsistentCasingInFileNames": true, "noFallthroughCasesInSwitch": true, - "moduleResolution": "Node16", - "module": "Node16", + "moduleResolution": "Bundler", + "module": "ES2022", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true,