Skip to content

env variable DEBUG is not parsed correctly #989

Open
@zymon

Description

If the DEBUG env variable contains multiple items separated with spaces, then only the first one is used.

For example:
export DEBUG="APP_X APP_Y APP_Z"

Then, only the APP_X is enabled for debugging. Other apps are ignored. This is due to the way the string is parsed:

In debug\src\common.js, line 169:

const split = (typeof namespaces === 'string' ? namespaces : '') .trim() .replace(' ', ',') .split(',') .filter(Boolean);

replace('', ',') changes only the first occurrence of space

So, to fix it you can use regexp:

const split = (typeof namespaces === 'string' ? namespaces : '') .trim() .replace(/ /g, ',') .split(',') .filter(Boolean);

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