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

wrong version of path-to-regexp bundled - solutions? #126

Closed
ling1726 opened this issue Sep 14, 2017 · 9 comments
Closed

wrong version of path-to-regexp bundled - solutions? #126

ling1726 opened this issue Sep 14, 2017 · 9 comments

Comments

@ling1726
Copy link

Hi,

We're using express with found and found-relay. Currently we get a message concerning an outdated path-to-regexp lib. The root cause of this issue is that express uses version 0.1.7 while found uses version 1.7.

Warning: Incorrect version of path-to-regexp imported. If this is running from a client bundle, check your bundler settings.

Our webpack seems to bundle the 0.1.7 EVERY TIME. Has somebody encountered this issue already and has a solution to it?

We have already tried to explicitly add path-to-regexp@1.7 as a dependency to the project, but this fix does not seem to work 100% of the time

thx

@taion
Copy link
Contributor

taion commented Sep 14, 2017

It's possible you have DedupePlugin running too aggressively. Also check that your module tree looks right – you may just want to nuke node_modules and your lockfile and try again.

I can't really speak to how to make webpack do the right thing in your case specifically beyond the suggestions above.

@taion taion closed this as completed Sep 14, 2017
@Razinsky
Copy link

Razinsky commented Oct 3, 2017

I have the same issue here! I cannot make a simple regex path to work. I do the exact same thing as in the doc /path/:(\d+)id and it does not seem to be recognized by found at all ... I guess it's because of the bundled path-to-regexp version. @ling1726 any solution on your end?

@taion
Copy link
Contributor

taion commented Oct 3, 2017

Try explicitly installing path-to-regexp@^1 as a top-level dependency. That should make webpack do the right thing.

@Razinsky
Copy link

Razinsky commented Oct 3, 2017

Yeah I did set ^2.0.0 as an explicit dependency... I don't know if the issue is related to that because there's no error. The route I set is just not recognized. Here's my definition:

<Route
  path="/track/:(\d+)id"
  Component={TrackPage}
  query={TrackPageQuery}
  prepareVariables={(params) => ({ id: params.id })}
/>

Thanks.

@taion
Copy link
Contributor

taion commented Oct 3, 2017

You need to do \\d instead of \d to escape the \.

@Razinsky
Copy link

Razinsky commented Oct 6, 2017

The \\d doesn't help...

@taion
Copy link
Contributor

taion commented Oct 6, 2017

Oh, and it should be :id(\\d+), like in https://github.com/4Catalyzer/found/blob/master/test/Matcher.test.js#L125

Just follow the path-to-regexp docs.

@Razinsky
Copy link

Razinsky commented Oct 6, 2017

Ok! Now we're talking. I guess it may be a good idea to update the doc consequently.

Thanks @taion !

@taion
Copy link
Contributor

taion commented Oct 6, 2017

Oh, oops.

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

No branches or pull requests

3 participants