Skip to content

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

@MikeRomaa

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.

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