Skip to content

Commit

Permalink
fix: build esm, not cjs (#2712)
Browse files Browse the repository at this point in the history
* chore: remove unused tsconfig file file
* chore: fix type issue with clipboard item data
  • Loading branch information
stropitek committed Oct 18, 2023
1 parent e7a1748 commit 00ac175
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
4 changes: 3 additions & 1 deletion src/utils/clipboard/clipboard.ts
@@ -1,3 +1,5 @@
import type { ClipboardItemDataType } from 'clipboard-polyfill';

export function readText(): Promise<string> {
return import('clipboard-polyfill').then((c) => c.readText());
}
Expand All @@ -22,7 +24,7 @@ export function write(data: ClipboardItemInterface[]): Promise<void> {
}

export function newClipboardItem(
items: Record<string, string | Blob | PromiseLike<string | Blob>>,
items: Record<string, ClipboardItemDataType>,
options?: ClipboardItemOptions,
): Promise<ClipboardItem> {
return import('clipboard-polyfill').then(
Expand Down
4 changes: 1 addition & 3 deletions src/utils/clipboard/clipboardHooks.ts
Expand Up @@ -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 {
Expand Down
9 changes: 0 additions & 9 deletions tsconfig.cjs.json

This file was deleted.

4 changes: 2 additions & 2 deletions tsconfig.json
Expand Up @@ -11,8 +11,8 @@
"noImplicitAny": false,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "Node16",
"module": "Node16",
"moduleResolution": "Bundler",
"module": "ES2022",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
Expand Down

0 comments on commit 00ac175

Please sign in to comment.