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

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

Open
pimlie opened this issue Sep 9, 2019 · 0 comments

Comments

@pimlie
Copy link
Contributor

pimlie commented Sep 9, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants