File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
packages/analytics/src/plugin Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ function buildClientHintHeaders(clientHints?: ClientHints) {
3030interface WithSimpleAnalyticsOptions {
3131 hostname ?: string ;
3232 clientHints ?: ClientHints ;
33+ basePath ?: boolean ;
3334}
3435
3536export function withSimpleAnalytics (
@@ -48,17 +49,21 @@ export function withSimpleAnalytics(
4849 const nextAnalyticsConfig : NextConfig = {
4950 async rewrites ( ) {
5051 const existingRewrites = await nextConfig . rewrites ?.( ) ;
52+ const basePath = ! nextConfig . basePath ;
5153
5254 const rewrites = [
5355 {
56+ basePath,
5457 source : "/proxy.js" ,
5558 destination : `https://simpleanalyticsexternal.com/proxy.js?hostname=${ hostname } &path=/simple` ,
5659 } ,
5760 {
61+ basePath,
5862 source : "/auto-events.js" ,
5963 destination : "https://scripts.simpleanalyticscdn.com/auto-events.js" ,
6064 } ,
6165 {
66+ basePath,
6267 source : "/simple/:match*" ,
6368 destination : "https://queue.simpleanalyticscdn.com/:match*" ,
6469 } ,
You can’t perform that action at this time.
0 commit comments