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: don't escape dash in define regex #9980

Closed
wants to merge 1 commit into from

Conversation

jonaskuske
Copy link
Contributor

Description

fix #9964

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@patak-dev
Copy link
Member

As you explained in #9964 (comment), the define feature needs to work both during build and dev. So we can't allow dashes if they are only going to work during build. I think your recommendations in #9964 were on point, and we should keep define as is.

@jonaskuske
Copy link
Contributor Author

👍🏻👍🏻

I still think that constructing an invalid Regex isn't really sound though. What do you think about fixing the Regex so it doesn't throw an obscure error anymore, but printing a warning if a define key contains a character that can't be part of a variable/identifier?

@patak-dev
Copy link
Member

@jonaskuske that sounds like a great improvement 👍🏼

@sapphi-red sapphi-red marked this pull request as draft June 7, 2023 14:46
@sapphi-red
Copy link
Member

Given that we now use esbuild for define (#11151), I guess this is no longer needed.

@sapphi-red sapphi-red closed this Nov 14, 2023
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.

config.define incorrectly escapes -
3 participants