Skip to content

Commit 12f1d36

Browse files
Merge pull request #32 from ph1p/main
Add basePath flag
2 parents 8d1eda5 + 353ac99 commit 12f1d36

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

packages/analytics/src/plugin/with-simple-analytics.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ export function withSimpleAnalytics(
4545

4646
const clientHints = buildClientHintHeaders(options?.clientHints);
4747

48+
const basePathOption = nextConfig.basePath ? { basePath: false as const } : {};
49+
4850
const nextAnalyticsConfig: NextConfig = {
4951
async rewrites() {
5052
const existingRewrites = await nextConfig.rewrites?.();
@@ -53,14 +55,17 @@ export function withSimpleAnalytics(
5355
{
5456
source: "/proxy.js",
5557
destination: `https://simpleanalyticsexternal.com/proxy.js?hostname=${hostname}&path=/simple`,
58+
...basePathOption,
5659
},
5760
{
5861
source: "/auto-events.js",
5962
destination: "https://scripts.simpleanalyticscdn.com/auto-events.js",
63+
...basePathOption,
6064
},
6165
{
6266
source: "/simple/:match*",
6367
destination: "https://queue.simpleanalyticscdn.com/:match*",
68+
...basePathOption,
6469
},
6570
];
6671

0 commit comments

Comments
 (0)