فهرست منبع

chore: remove Plausible analytics integration and configure webpack for better development experience (#45)

Mat B. 1 ماه پیش
والد
کامیت
9c8bf06bea
5فایلهای تغییر یافته به همراه22 افزوده شده و 34 حذف شده
  1. 5 9
      app/[locale]/providers.tsx
  2. 17 5
      next.config.ts
  3. 0 1
      package.json
  4. 0 16
      pnpm-lock.yaml
  5. 0 3
      src/features/email/EmailForm.tsx

+ 5 - 9
app/[locale]/providers.tsx

@@ -1,13 +1,11 @@
 "use client";
 
 import { NuqsAdapter } from "nuqs/adapters/next/app";
-import PlausibleProvider from "next-plausible";
 import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
 import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
 
 import { I18nProviderClient } from "locales/client";
 import { AnalyticsProvider } from "@/shared/lib/analytics/client";
-import { SiteConfig } from "@/shared/config/site-config";
 import { DialogRenderer } from "@/features/dialogs-provider/DialogProvider";
 import { ToastSonner } from "@/components/ui/ToastSonner";
 import { Toaster } from "@/components/ui/toaster";
@@ -25,13 +23,11 @@ export const Providers = ({ children, locale }: PropsWithChildren<{ locale: stri
         <QueryClientProvider client={queryClient}>
           <I18nProviderClient locale={locale}>
             <ThemeProvider attribute="class" defaultTheme="system" disableTransitionOnChange enableSystem>
-              <PlausibleProvider domain={SiteConfig.domain}>
-                <Toaster />
-                <ToastSonner />
-                <DialogRenderer />
-                <ReactQueryDevtools initialIsOpen={false} />
-                {children}
-              </PlausibleProvider>
+              <Toaster />
+              <ToastSonner />
+              <DialogRenderer />
+              <ReactQueryDevtools initialIsOpen={false} />
+              {children}
             </ThemeProvider>
           </I18nProviderClient>
         </QueryClientProvider>

+ 17 - 5
next.config.ts

@@ -1,7 +1,3 @@
-import { withPlausibleProxy } from "next-plausible";
-
-import { env } from "@/env";
-
 import type { NextConfig } from "next";
 
 const nextConfig: NextConfig = {
@@ -17,6 +13,22 @@ const nextConfig: NextConfig = {
       },
     ],
   },
+  experimental: {
+    turbo: {
+      rules: {
+        "*.svg": {
+          loaders: ["@svgr/webpack"],
+          as: "*.js",
+        },
+      },
+    },
+  },
+  webpack: (config, { dev }) => {
+    if (dev) {
+      config.devtool = "cheap-module-source-map";
+    }
+    return config;
+  },
 };
 
-export default withPlausibleProxy()(nextConfig);
+export default nextConfig;

+ 0 - 1
package.json

@@ -92,7 +92,6 @@
     "next": "15.2.3",
     "next-international": "^1.3.1",
     "next-mdx-remote": "^5.0.0",
-    "next-plausible": "^3.12.4",
     "next-safe-action": "^7.10.4",
     "next-themes": "^0.4.6",
     "nodemailer": "^6.10.0",

+ 0 - 16
pnpm-lock.yaml

@@ -227,9 +227,6 @@ importers:
       next-mdx-remote:
         specifier: ^5.0.0
         version: 5.0.0(@types/react@19.1.8)(acorn@8.15.0)(react@19.1.0)
-      next-plausible:
-        specifier: ^3.12.4
-        version: 3.12.4(next@15.2.3(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
       next-safe-action:
         specifier: ^7.10.4
         version: 7.10.8(next@15.2.3(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(zod@3.25.64)
@@ -4063,13 +4060,6 @@ packages:
     peerDependencies:
       react: '>=16'
 
-  next-plausible@3.12.4:
-    resolution: {integrity: sha512-cD3+ixJxf8yBYvsideTxqli3fvrB7R4BXcvsNJz8Sm2X1QN039WfiXjCyNWkub4h5++rRs6fHhchUMnOuJokcg==}
-    peerDependencies:
-      next: '^11.1.0 || ^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 '
-      react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
-      react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
-
   next-safe-action@7.10.8:
     resolution: {integrity: sha512-cTBoPWtvQ0t83N0a5zaveOh9vP2g3//d0hgzPJ4ch1EXCyt9+bavbVNgyOYbzWUwFerppHeFXPYsg7pbRulLQw==}
     engines: {node: '>=18.17'}
@@ -9712,12 +9702,6 @@ snapshots:
       - acorn
       - supports-color
 
-  next-plausible@3.12.4(next@15.2.3(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(react-dom@19.1.0(react@19.1.0))(react@19.1.0):
-    dependencies:
-      next: 15.2.3(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
-      react: 19.1.0
-      react-dom: 19.1.0(react@19.1.0)
-
   next-safe-action@7.10.8(next@15.2.3(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(zod@3.25.64):
     dependencies:
       next: 15.2.3(react-dom@19.1.0(react@19.1.0))(react@19.1.0)

+ 0 - 3
src/features/email/EmailForm.tsx

@@ -1,6 +1,5 @@
 "use client";
 
-import { usePlausible } from "next-plausible";
 import { AlertCircle, CheckCircle } from "lucide-react";
 import { AnimatePresence, motion } from "framer-motion";
 import { useMutation } from "@tanstack/react-query";
@@ -27,12 +26,10 @@ export const EmailForm = ({
   const form = useZodForm({
     schema: EmailActionSchema,
   });
-  const plausible = usePlausible();
 
   const submit = useMutation({
     mutationFn: async ({ email }: EmailActionSchemaType) => {
       const action = await addEmailAction({ email });
-      plausible("Email+Submit");
 
       if (action?.data) {
         return action.data;