vue-router icon indicating copy to clipboard operation
vue-router copied to clipboard

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

Open pimlie opened this issue 6 years ago • 0 comments

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: 76d83b6eb4af507763c5ee6f61a52ed9a7804572

pimlie avatar Sep 09 '19 12:09 pimlie