From 5089c42421e04dd9650a2729b78689fb5fbdb730 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Tue, 29 Oct 2024 18:30:02 -0700 Subject: [PATCH] Updated tracker script rewrite. --- next.config.js | 12 +++++------- rollup.tracker.config.mjs | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/next.config.js b/next.config.js index 33a43ee7bb..808d369146 100644 --- a/next.config.js +++ b/next.config.js @@ -3,7 +3,7 @@ require('dotenv').config(); const path = require('path'); const pkg = require('./package.json'); -const TRACKER_SCRIPT = '/script.js'; +const TRACKER_SCRIPT = '/tracker.js'; const basePath = process.env.BASE_PATH; const collectApiEndpoint = process.env.COLLECT_API_ENDPOINT; @@ -68,12 +68,10 @@ const headers = [ const rewrites = []; -if (trackerScriptURL) { - rewrites.push({ - source: TRACKER_SCRIPT, - destination: trackerScriptURL, - }); -} +rewrites.push({ + source: '/script.js', + destination: trackerScriptURL || TRACKER_SCRIPT, +}); if (collectApiEndpoint) { rewrites.push({ diff --git a/rollup.tracker.config.mjs b/rollup.tracker.config.mjs index 05df28798d..4b1f0e0e25 100644 --- a/rollup.tracker.config.mjs +++ b/rollup.tracker.config.mjs @@ -5,7 +5,7 @@ import { terser } from 'rollup-plugin-terser'; export default { input: 'src/tracker/index.js', output: { - file: 'public/script.js', + file: 'public/tracker.js', format: 'iife', }, plugins: [