From 6f6bd7cf273871a84b6f2dd1742ee8ab8592dd71 Mon Sep 17 00:00:00 2001 From: Simon Reinisch Date: Wed, 24 Apr 2024 17:55:40 +0200 Subject: [PATCH] Fix external libs in preact build Closes #221 --- packages/preact/src/SelectionArea.tsx | 3 +-- packages/preact/vite.config.ts | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/preact/src/SelectionArea.tsx b/packages/preact/src/SelectionArea.tsx index 7a06120..04154e1 100644 --- a/packages/preact/src/SelectionArea.tsx +++ b/packages/preact/src/SelectionArea.tsx @@ -2,8 +2,7 @@ import VanillaSelectionArea from '@viselect/vanilla'; import {SelectionEvents, SelectionOptions} from '@viselect/vanilla'; import {createContext, createRef, FunctionalComponent, JSX} from 'preact'; -import {useContext} from 'preact/compat'; -import {useEffect, useState} from 'preact/hooks'; +import {useEffect, useContext, useState} from 'preact/hooks'; export interface SelectionAreaProps extends Omit, 'boundaries'>, JSX.HTMLAttributes { id?: string; diff --git a/packages/preact/vite.config.ts b/packages/preact/vite.config.ts index 947cdba..e654bbd 100644 --- a/packages/preact/vite.config.ts +++ b/packages/preact/vite.config.ts @@ -26,11 +26,11 @@ export default defineConfig(env => ({ fileName: 'viselect', }, rollupOptions: { - external: ['preact', '@viselect/react'], + external: ['preact', 'preact/hooks', '@viselect/vanilla'], output: { globals: { preact: 'Preact', - '@viselect/react': 'SelectionArea' + '@viselect/vanilla': 'SelectionArea' }, }, },