From fffaea8a8d9c8f15e556b6f12879ba2d16ba0902 Mon Sep 17 00:00:00 2001 From: wong2 Date: Thu, 9 Nov 2023 12:26:54 +0800 Subject: [PATCH] Add jotai utils to vite config --- vite.config.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 0b7d0a5..bdc20ff 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,13 +1,22 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' import { crx } from '@crxjs/vite-plugin' +import react from '@vitejs/plugin-react' +import jotaiDebugLabel from 'jotai/babel/plugin-debug-label' +import jotaiReactRefresh from 'jotai/babel/plugin-react-refresh' +import { defineConfig } from 'vite' import tsconfigPaths from 'vite-tsconfig-paths' import manifest from './manifest.config' -// https://vitejs.dev/config/ -export default defineConfig(({ command, mode }) => { +export default defineConfig(({ mode }) => { return { - plugins: [tsconfigPaths(), react(), crx({ manifest })], + plugins: [ + tsconfigPaths(), + react({ + babel: { + plugins: [jotaiDebugLabel, jotaiReactRefresh], + }, + }), + crx({ manifest }), + ], build: { rollupOptions: { input: ['app.html'],