You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes, custom comment tags can be a problem and I probably shouldn't have added support without validating the tags for regex chars. In fact, using a Regex in general is always potentially flawed--though with highly-specific comment tags then it is generally unlkely a problem can occur. But to have a more universal solution, the plugin would need to access and traverse the AST.
I've considered whether custom tags should be allowed at all, for the exact issue that it's not too difficult that people write tags that will break the loader. My options are
Adding validation to check that checks for RegEx chars (e.g. (.\/+? etc.) and throw informative error messages (plus documentation)
Not allow custom tags
Leverage and traverse AST of each module to identify and remove the blocks (a more robust but harder to implement solution that would likely slow down webpack builds slightly).
For the time being, I recommend people only use pretty unique text without regex special chars for the start and end tags. I am leaning towards option 1 as a solution, so at some point--when I have evaluated everything--I will try to work on those changes.
Comment tags with parentheses don't work. For example, this loader:
won't work correctly because it breaks the underlying regex. Any similar unescaped char would probably also break the regex.
If this is intended (allow users to write regex fragments?) it should be documented in the README.
The text was updated successfully, but these errors were encountered: