Skip to content

replace plugin. default "delimiters" value is breaking for developers #905

@o-alexandrov

Description

@o-alexandrov
  • Rollup Plugin Name: @rollup/plugin-replace
  • Rollup Plugin Version: 2.4.2 (currently latest)
  • Rollup Version: 2.50.6
  • Operating System (or Browser): macos (but it's irrelevant in this case)
  • Node Version: 16 (but it's irrelevant in this case)
  • Link to reproduction: a PR fix(replace)!: issues with nested objects replacements #903

Actual Behavior

Currently, developers have issues with replacements w/ nested access.
If you attempt to replace typeof window with "object", you would see the following scenarios:

  • typeof window will be replaced
  • typeof window.document will be replaced, resulting in "object".document (which is an error)
  • typeof windowSmth will not be replaced due to a \b boundary

Expected Behavior

  • typeof window.document will NOT be replaced, resulting in "object".document (which is an error)

Metadata

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