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

replace: objectGuards not working #1178

Open
privatenumber opened this issue Apr 29, 2022 · 3 comments
Open

replace: objectGuards not working #1178

privatenumber opened this issue Apr 29, 2022 · 3 comments

Comments

@privatenumber
Copy link

privatenumber commented Apr 29, 2022

Input

index.js

if (typeof process !== 'undefined' && process.env.NODE_ENV === 'production') {
	console.log('production');
}

Expected Behavior

@rollup/plugin-replace README says the output should be:

if ('object' !== 'undefined' && 'production' === 'production') {
  console.log('production');
}

Actual Behavior

typeof process is not replaced.

Output

if (typeof process !== 'undefined' && "production" === 'production') {
	console.log('production');
}

Additional Information

There is no regression. Looks like the feature was merged when it was not working: #1084 (comment)

@stale stale bot added the x⁷ ⋅ stale label Jul 10, 2022
@stale
Copy link

stale bot commented Jul 12, 2022

Hey folks. This issue hasn't received any traction for 60 days, so we're going to close this for housekeeping. If this is still an ongoing issue, please do consider contributing a Pull Request to resolve it. Further discussion is always welcome even with the issue closed. If anything actionable is posted in the comments, we'll consider reopening it.

@stale stale bot closed this as completed Jul 12, 2022
@niba1122
Copy link

niba1122 commented Aug 24, 2022

I met same problem and maybe actual issue.
Internal patterns for typeof (e.g. typeof process !==) does not work because of delimiters ['\\b', '\\b(?!\\.)'] added by #1088.

@privatenumber
Copy link
Author

I don't think it was ever working:

There is no regression. Looks like the feature was merged when it was not working: #1084 (comment)

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

3 participants