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

The module breaks with create-react-app v4 applications (parseUrl is not a function) #152

Open
niryarden opened this issue Oct 2, 2022 · 0 comments

Comments

@niryarden
Copy link

niryarden commented Oct 2, 2022

Issue:

The module breaks, and as a result unusable from React applications that were created using the 4th version of create-react-app. (create-react-app has a 5th version in the which the problem does not exist, but it can be very complicated to upgrade it). Many React applications are still using the 4th version and as a result cannot use this great module 😖
I believe the reason for the issue is this commit:
IonicaBizau/parse-url@a10861c#diff-92bbac9a308cd5fcf9db165841f2d90ce981baddcb2b1e26cfff170929af3bd1L51
(and this can also be relevant - https://stackoverflow.com/a/43249395)

Reproducion Steps:

Create a new create-react-app application

npx create-react-app my-app

Downgrade it to create-react-app v4

in package json of the project, change react-scripts dependency to version ^4.0.3, and run

npm install

Add git-url-parse to your project and use it

npm install git-url-parse

and use the module in App.js, for example:

import { useEffect } from 'react';
import gitUrlParse from 'git-url-parse';

function App() {
  useEffect(() => {
    const res = gitUrlParse("https://github.com/IonicaBizau/git-url-parse");
    console.log(res);
  }, [])

  return (
    <div />
  );
}

export default App;

Run the app and get the error in the browser console:

npm start

console:

index.js:29 Uncaught TypeError: parseUrl is not a function
    at gitUp (index.js:29:1)
    at gitUrlParse (index.js:48:1)
    at App.js:6:1
    at commitHookEffectListMount (react-dom.development.js:23150:1)
    at commitPassiveMountOnFiber (react-dom.development.js:24926:1)
    at commitPassiveMountEffects_complete (react-dom.development.js:24891:1)
    at commitPassiveMountEffects_begin (react-dom.development.js:24878:1)
    at commitPassiveMountEffects (react-dom.development.js:24866:1)
    at flushPassiveEffectsImpl (react-dom.development.js:27039:1)
    at flushPassiveEffects (react-dom.development.js:26984:1)
    at react-dom.development.js:26769:1
    at workLoop (scheduler.development.js:266:1)
    at flushWork (scheduler.development.js:239:1)
    at performWorkUntilDeadline (scheduler.development.js:533:1)
    at run (setImmediate.js:40:1)
    at runIfPresent (setImmediate.js:69:1)
    at onGlobalMessage (setImmediate.js:109:1)
jpellizzari added a commit to weaveworks/weave-gitops-enterprise that referenced this issue Sep 28, 2023
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

1 participant