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

fix(replace): objectGuards doesn't take effects #1764

Merged
merged 2 commits into from
Sep 23, 2024

Conversation

ikkz
Copy link
Contributor

@ikkz ikkz commented Sep 2, 2024

Rollup Plugin Name: {replace}

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.

List any relevant issue numbers: #1084 and #1178

Description

The plugin-replace's option objectGuards doesn't take effects actually. It is caused mainly by the wrong implementation of function expandTypeofReplacements.

On master, this function expands process.env.NODE_ENV to typeof process ... and typeof env ..., which is unreasonable. The correct result should be typeof process and typeof process.env. And the expanded keys won't match the default right delimiters (related comment)

@shellscape
Copy link
Collaborator

@ikkz it looks like you need to rebase on upstream/master for CI to run.

BREAKING CHANGES: Fixed the problem that the objectGuards option did not take effect, so the bundle results before and after may be inconsistent
@ikkz
Copy link
Contributor Author

ikkz commented Sep 23, 2024

@shellscape I have rebased. Could you please review it again? Thanks!

@shellscape shellscape merged commit 8c213e0 into rollup:master Sep 23, 2024
5 checks passed
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

Successfully merging this pull request may close these issues.

2 participants