From 07a35ef03e8ef53603ed602ae9778fd710eee206 Mon Sep 17 00:00:00 2001 From: Zoheb Salam Date: Thu, 21 Sep 2023 13:35:38 +0200 Subject: [PATCH] use rewrite instead of redirect --- next.config.js | 15 ++++++++++++--- package.json | 1 - pages/_app.js | 6 +++--- pnpm-lock.yaml | 15 --------------- 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/next.config.js b/next.config.js index 6b7df769..de50d0f1 100644 --- a/next.config.js +++ b/next.config.js @@ -4,11 +4,8 @@ const withNextra = require("nextra")({ latex: true, }); -const { withPlausibleProxy } = require("next-plausible"); - module.exports = { ...withNextra(), - ...withPlausibleProxy(), async redirects() { return [ { @@ -33,4 +30,16 @@ module.exports = { }, ]; }, + async rewrites() { + return [ + { + source: "/js/script.js", + destination: "https://plausible.io/js/script.js", + }, + { + source: "/api/event", + destination: "https://plausible.io/api/event", + }, + ]; + }, }; diff --git a/package.json b/package.json index a6cf7325..8caae0f8 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,6 @@ "dependencies": { "classnames": "2.3.2", "next": "^13.5.1", - "next-plausible": "^3.11.1", "nextra": "latest", "nextra-theme-docs": "latest", "react": "^18.2.0", diff --git a/pages/_app.js b/pages/_app.js index ae5c345b..13422931 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -1,11 +1,11 @@ -import PlausibleProvider from "next-plausible"; import "../styles/globals.css"; import Script from "next/script"; export default function MyApp({ Component, pageProps }) { return ( - + <> ; + - + ); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 793695c0..ac790a7e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,9 +11,6 @@ dependencies: next: specifier: ^13.5.1 version: 13.5.1(react-dom@18.2.0)(react@18.2.0) - next-plausible: - specifier: ^3.11.1 - version: 3.11.1(next@13.5.1)(react-dom@18.2.0)(react@18.2.0) nextra: specifier: latest version: 2.12.3(next@13.5.1)(react-dom@18.2.0)(react@18.2.0) @@ -2434,18 +2431,6 @@ packages: - supports-color dev: false - /next-plausible@3.11.1(next@13.5.1)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-Gd+QU+XflVTx65yJ2cNZyrOQLrpz3uKjGLEG4ls+CIVqK3yjsVGCMsEWJcvv1LAeVfHUQtCyp1xyAltLn5Odcg==} - peerDependencies: - next: ^11.1.0 || ^12.0.0 || ^13.0.0 - react: ^16.8.0 || ^17.0.0 || ^18.0.0 - react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 - dependencies: - next: 13.5.1(react-dom@18.2.0)(react@18.2.0) - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - dev: false - /next-seo@6.1.0(next@13.5.1)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-iMBpFoJsR5zWhguHJvsoBDxDSmdYTHtnVPB1ij+CD0NReQCP78ZxxbdL9qkKIf4oEuZEqZkrjAQLB0bkII7RYA==} peerDependencies: