Skip to content

Out of the box, using the SDK according to the instructions causes an errorΒ #228

@whiny-nil

Description

@whiny-nil

Using the JS Client SDK out-of-the box causes an error when the web app is loaded:

"Uncaught (in promise) ReferenceError: process is not defined"

The error occurs on line 9 of @eppo/js-client-sdk/common/dist/application-logger.js:

    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.logger = exports.loggerPrefix = void 0;
    const pino_1 = require("pino");
    exports.loggerPrefix = '[Eppo SDK]';
    // Create a Pino logger instance
    exports.logger = (0, pino_1.default)({
        // eslint-disable-next-line no-restricted-globals
>>>     level: process.env.LOG_LEVEL ?? (process.env.NODE_ENV === 'production' ? 'warn' : 'info'),
        // https://getpino.io/#/docs/browser
        browser: { disabled: true },
    });
    //# sourceMappingURL=application-logger.js.map

In order to solve this, I had to manually add these lines to my own webpack configuration:

// Replace process.env.LOG_LEVEL with null (`process` is not defined in the browser env)

I'm using version 3.16.1 (the current version when I typed this).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions