Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] ERR_MODULE_NOT_FOUND error when using ‘posthog-js/lib/src/customisations’ #1667

Open
lucashan13 opened this issue Jan 22, 2025 · 0 comments

Comments

@lucashan13
Copy link

Hello, Posthog team!

I'm trying to use your library and I have a question.

I'm using this documentation to set up sampling, but I ran into a problem.

I'm getting an ERR_MODULE_NOT_FOUND error on import { sampleByDistinctId } from posthog-js/lib/src/customisations, and when I looked into it, the files built in that path are being served like ESM (using import, export), and I'm guessing that the module isn't being found because it's missing the ‘.js’ at the end of the file I'm importing.

Can you tell me why the module is being served like this?

e.g.

import { CAMPAIGN_PARAMS, EVENT_TO_PERSON_PROPERTIES, Info } from '../utils/event-utils';
import { each, extend } from '../utils';
import { includes } from '../utils/string-utils';
export var setAllPersonProfilePropertiesAsPersonPropertiesForFlags = function (posthog) {
    var allProperties = extend({}, Info.properties({
        maskPersonalDataProperties: posthog.config.mask_personal_data_properties,
        customPersonalDataProperties: posthog.config.custom_personal_data_properties,
    }), Info.campaignParams({
        customTrackedParams: posthog.config.custom_campaign_params,
        maskPersonalDataProperties: posthog.config.mask_personal_data_properties,
        customPersonalDataProperties: posthog.config.custom_personal_data_properties,
    }), Info.referrerInfo());
    var personProperties = {};
    each(allProperties, function (v, k) {
        if (includes(CAMPAIGN_PARAMS, k) || includes(EVENT_TO_PERSON_PROPERTIES, k)) {
            personProperties[k] = v;
        }
    });
    posthog.setPersonPropertiesForFlags(personProperties);
};
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

No branches or pull requests

1 participant