Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/analytics/src/plugin/with-simple-analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export function withSimpleAnalytics(

const clientHints = buildClientHintHeaders(options?.clientHints);

const basePathOption = nextConfig.basePath ? { basePath: false as const } : {};

const nextAnalyticsConfig: NextConfig = {
async rewrites() {
const existingRewrites = await nextConfig.rewrites?.();
Expand All @@ -53,14 +55,17 @@ export function withSimpleAnalytics(
{
source: "/proxy.js",
destination: `https://simpleanalyticsexternal.com/proxy.js?hostname=${hostname}&path=/simple`,
...basePathOption,
},
{
source: "/auto-events.js",
destination: "https://scripts.simpleanalyticscdn.com/auto-events.js",
...basePathOption,
},
{
source: "/simple/:match*",
destination: "https://queue.simpleanalyticscdn.com/:match*",
...basePathOption,
},
];

Expand Down
Loading