Skip to content

Commit

Permalink
Updated tracker script rewrite.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecao committed Oct 30, 2024
1 parent 9211c5f commit 5089c42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion rollup.tracker.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down

0 comments on commit 5089c42

Please sign in to comment.