Skip to content

Keep path-to-regexp as a dependency for non-browser builds (or expose its exports) #2924

Open
@pimlie

Description

@pimlie

What problem does this feature solve?

For vue-router v2.0.0 path-to-regexp was moved from a dependency to a dev dependency (thanks @pi0 for finding the commit).

Unfortunately the commit doesnt list a reason why this was (probably mostly security/political?), but I think it could make sense to keep path-to-regexp as an external dependency for non-browser builds.

One reason is that Nuxt.js also uses e.g. the tokensToFunction method of path-to-regexp. This means that currently a Nuxt.js app will include two copies of that function, one from vue-router and one from Nuxt.js itself which increases the bundle size needlessly.

Another solution for the above could be that vue-router would expose the path-to-regexp methods like tokensToFunction method so Nuxt.js can use those, but using dependencies has more benefits ofc like quicker delivery of patches for path-to-regexp.

What does the proposed API look like?

Revert: 76d83b6

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions