Skip to content

Avoid using RegExp special symbols in virtual paths, e.g. $$virtual -> __virtual #2378

@non25

Description

@non25

First of all, I want to say thanks to the yarn team for a great work. It made my js package-management workflow actually enjoyable.

And now to the issue itself.

Using $$virtual as a base for virtual paths breaks people's naive RegExp code in the packages, which work completely fine in node_modules scenario.

Maintainers of such packages are not going to react to PRs fast enough, and it just makes it harder to work on actual issues in forks using portal: for no apparent reason.

Such PRs could actually break something else, which is not obvious right away, because lack of tests, etc.

sveltejs/svelte-loader#149
sveltejs/svelte-loader#155
https://github.com/rixo/svelte-hmr/pull/23

It also requires a dedicated @merceyz to save the day, whether he wants it at the moment or not. 🙂

I've been working on svelte-loader, where this situation occured and this was just getting in the way, spoiling my amazing yarn berry experience.

I wanted to just check if my fork is actually working and get done with the day, but after digging through unrelated code had to ask @merceyz to help me fix it.

I feel like the probability of having $ somewhere around node_modules is too low to justify making $-proof RegExp's everywhere in people's packages.

If it isn't gonna break existing commited .pnp.js'es in user's PnP zero-install repos, maybe it is reasonable to save some frustration for almost no cost?

What do you think?

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