JS Errors

This section lists the most encountered Javascript errors and reported by our community.

ReferenceError: Navigator is not defined

Sometimes this error occurs when you try to import tracker-assist or tracker-fetch plugins, this happens because node is trying to build the page without window API in the env.

The fix is fairly simple. All you have to do is to change the regular import of the trouble-causing plugin:

import trackerAssist from '@openreplay/tracker-assist/cjs';

To dynamically import inside componendDidMount or useEffect alternative:

import Tracker, { Options } from "@openreplay/tracker";
const tracker = new Tracker({ /* your options */ });
class TrackerComponent extends React.Component {
componentDidMount = () => {
import(‘@openreplay/tracker-assist/cjs’).then(({ default: trackerAssist }) => {
tracker.start(/* your options */)
tracker.use(trackerAssist(/* your assist options */))
/* Other code */

This way all window API dependant plugins will be imported when the component gets rendered.

Critical dependency: the request of a dependency is an expression

This may happen with old versions of tracker-assist plugin. You should apply this workaround if you face the below error when compiling:

Failed to compile.
Critical dependency: the request of a dependency is an expression

My problem is not listed

If you encounter any errors that are not listed in this page, feel free to raise an issue or simply reach out to our Slack to get help from our community.