Skip to content

fix: make the Google Analytics loader compile in the site build - #72

Merged
arbrandes merged 2 commits into
openedx:mainfrom
arbrandes:arbrandes/fix-google-analytics-loader-types
Aug 7, 2026
Merged

fix: make the Google Analytics loader compile in the site build#72
arbrandes merged 2 commits into
openedx:mainfrom
arbrandes:arbrandes/fix-google-analytics-loader-types

Conversation

@arbrandes

@arbrandes arbrandes commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Description

Enabling tutor-contrib-google-analytics broke tutor images build mfe mfe-dev: the frontend-base site build failed with six TypeScript errors in src/customApp.tsx.

The plugin inlines a single GoogleAnalyticsLoader snippet into two pipelines. env.config.jsx (legacy MFEs) is only ever run through Babel, but customApp.tsx (the frontend-base site) is compiled by tsc with strict: true and noImplicitAny: false. The loader had been copied verbatim from @openedx/frontend-platform, where it only ever lived in a .js file, so it had never had to satisfy a type checker.

This rewrites the snippet as plain JavaScript that also type-checks, keeping it usable by both pipelines.

LLM usage notice

Built with assistance from Claude.

The loader was copied verbatim from frontend-platform, where it only ever
lived in a .js file. Inlining it into customApp.tsx put it under the
frontend-base type checker, which rejected the implicit this.analyticsId
property, the undeclared global, and the possibly-null parentNode.

Rewrite it as plain JavaScript that also type-checks, and drop the unused
Segment-style load() indirection while at it.

Co-Authored-By: Claude <noreply@anthropic.com>
@arbrandes
arbrandes merged commit 877d383 into openedx:main Aug 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant