From 19c1e68b85f1b980879ec5ba6adcf58e07207f9d Mon Sep 17 00:00:00 2001 From: kang Date: Tue, 22 Oct 2024 00:29:35 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EB=AA=A8=EB=8B=AC=20=EB=82=B4?= =?UTF-8?q?=EB=B6=80=20=EC=BB=A8=ED=85=90=EC=B8=A0=20=EB=A9=94=EB=AA=A8?= =?UTF-8?q?=EC=9D=B4=EC=A0=9C=EC=9D=B4=EC=85=98,=20sideEffect=20false?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + pnpm-lock.yaml | 2 +- src/content/components/MainModal.tsx | 9 +++++++-- vite.config.ts | 12 ------------ 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 6fd58da..9a5c71c 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "version": "2.0.7", "license": "MIT", "type": "module", + "sideEffects": false, "scripts": { "dev": "vite", "build": "tsc && vite build", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d11ca84..f749a83 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -53,7 +53,7 @@ dependencies: devDependencies: '@crxjs/vite-plugin': - specifier: 2.0.0-beta.26 + specifier: ^2.0.0-beta.26 version: 2.0.0-beta.26 '@thedutchcoder/postcss-rem-to-px': specifier: ^0.0.2 diff --git a/src/content/components/MainModal.tsx b/src/content/components/MainModal.tsx index 231c824..9b9f2b3 100644 --- a/src/content/components/MainModal.tsx +++ b/src/content/components/MainModal.tsx @@ -1,5 +1,5 @@ import { motion } from 'framer-motion' -import { useState } from 'react' +import { useState, useMemo } from 'react' import { BottomNavigation } from './BottomNavigation' import { SettingsContent } from './setting' @@ -28,16 +28,21 @@ const modalVariants: Variants = { export function MainModal() { const [activeTab, setActiveTab] = useState<'tasks' | 'settings'>('tasks') + const Content = useMemo(() => { + return activeTab === 'tasks' ? : + }, [activeTab]) + return (
- {activeTab === 'tasks' ? : } + {Content}
diff --git a/vite.config.ts b/vite.config.ts index d3f88ac..1ac4e2a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import { crx } from '@crxjs/vite-plugin' import react from '@vitejs/plugin-react' import { resolve } from 'path' @@ -25,15 +24,4 @@ export default defineConfig({ '@/assets': resolve(__dirname, './src/assets'), }, }, - build: { - chunkSizeWarningLimit: 1024, - rollupOptions: { - onwarn(warning, warn) { - if (warning.code === 'MODULE_LEVEL_DIRECTIVE') { - return - } - warn(warning) - }, - }, - }, })