Skip to content

process.env.* in strings should not be replaced #9

Description

@MikeRomaa

Describe the problem

Mach will replace both occurrences of process.env.SENTRY_DSN in the following code:

if (process.env.SENTRY_DSN) {
    Sentry.init({ dsn: process.env.SENTRY_DSN });
} else {
    console.warn("`process.env.SENTRY_DSN` is not configured, errors will not be logged in Sentry");
}

This leads to an error that claims:

Expected ")" but found "https"

This is due to the fact that the second occurrence is also replaced, which causes the quotation signs to get clobbered.

Mach should only replace references to the literal process.env variable--not any occurrence of the string in the source code.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions