-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[Bug]: Compilation of react app fails with error ERROR in ./node_modules/react-router/dist/index.js 840:33-54 #10566
Comments
The issue is with the latest package 6.12.0 |
Same error with: |
Downgrading the react-router version fixed the issue. |
Yes, it works with: React: 17.0.2 |
Just noting that we are running into this in the Backstage project (a framework for building an internal developer portal open sourced by Spotify): backstage/backstage#18155 |
Huh, this looks to only be an issue in This seems to be a workaround to fix the webpack compilation issue: #10569 |
This worked for me > > Downgrading the react-router version fixed the issue.
|
I was not using "react-router" but using "react-router-dom". |
🤖 Hello there, We just published version Thanks! |
Re-opening until the stable release |
👋 Hey folks! Does anyone want to give |
I test with |
🤖 Hello there, We just published version Thanks! |
Tested with the fix and found it working |
Its working! thanks :) |
This has resurfaced in Could be that the best fix for this at this point is to switch the import back to |
Honestly this feels to me like an issue with webpack or maybe Babel. I don't see any reason why this approach to feature detection shouldn't work. |
@Rugvip Can you provide a reproduction if the issue you are seeing? We've confirmed that |
@brophdawg11 Ah sorry didn't look at the error closely enough, it's not a runtime/webpack issue, it's a TypeScript issue:
I believe anyone trying to use react-router with react 17 would run into this issue |
Why is your TS setup trying to typecheck library code in |
@brophdawg11 you'll need to disable |
OK - that reproduces it for me, but that is indeed a net-new issue since the app compiles and runs fine. It's due to the |
What version of React Router are you using?
6.2.2
Steps to Reproduce
This issue has started to occur from today, it was working ok till yesterday.
I develop a react web application (react 17.0.2), using react-router-dom 6.2.2.
package.json is as follows
{
"name": "WebUI_Framework",
"version": "0.1.0",
"private": true,
"dependencies": {
"@babel/plugin-transform-react-jsx": "^7.17.3",
"@reduxjs/toolkit": "^1.8.0",
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^12.1.4",
"@testing-library/user-event": "^13.5.0",
"axios": "^0.26.1",
"bootstrap-icons": "^1.9.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-icons": "^4.3.1",
"react-redux": "^7.2.6",
"react-router-dom": "^6.2.2",
"react-scripts": "5.0.0",
"redux": "^4.1.2",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@babel/cli": "^7.17.6",
"@babel/core": "^7.17.9"
},
"exports": {
".": "./index.js"
}
}
When the development server is started with npm start, the following error is shown
ERROR in ./node_modules/react-router-dom/dist/index.js 266:33-54
export 'startTransition' (imported as 'React') was not found in 'react' (possible exports: Children, Component, Fragment, Profiler, PureComponent, StrictMode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, cloneElement, createContext, createElement, createFactory, createRef, forwardRef, isValidElement, lazy, memo, useCallback, useContext, useDebugValue, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, version)
@ ./src/main.js 6:0-61 20:40-50
@ ./src/index.js 3:0-30 5:0-4
Expected Behavior
It is expected to work smoothly
Actual Behavior
The errors get shown
ERROR in ./node_modules/react-router-dom/dist/index.js 266:33-54
export 'startTransition' (imported as 'React') was not found in 'react' (possible exports: Children, Component, Fragment, Profiler, PureComponent, StrictMode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, cloneElement, createContext, createElement, createFactory, createRef, forwardRef, isValidElement, lazy, memo, useCallback, useContext, useDebugValue, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, version)
@ ./src/main.js 6:0-61 20:40-50
@ ./src/index.js 3:0-30 5:0-4
The text was updated successfully, but these errors were encountered: