-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
4.0.0 breaks with typescript (all versions) #9868
Comments
There is another similar issue with updating the TypeScript config file. We're still trying to determine the root cause. In this particular case you can work around it by manually setting |
@iansu That doesn't work. I did the same steps as above, and put I get the same error when running |
That was working for me. You can also try deleting your tsconfig.json and it should automatically get recreated with the new settings. |
First attempt:
Error:
Second try: deleting tsconfig.json before running Here's the recreated tsconfig.json:
That looks exactly the same as the file I had before 😕 |
I don't know why just changing that value wasn't working for you. This is an annoying bug that we're hoping to have fixed soon. |
@iansu I found it!! I started debugging First issue I found: (line 151)
It must be Perfect example why people use TypeScript instead of plain old JS. 😏 |
You're right about the capitalization but I don't know if that's the root issue. For example, if you change |
If you'd like to submit a PR to fix that casing issue that would be appreciated. |
Already done: #9869 |
True. But at least I can now restart my app without always deleting tsconfig.json Btw: I doesn't matter what you change. You don't have to change anything at all. Just save the file as is, and you'll get the error. |
More Information:
That would explain why the property isn't writable. How about a simple workaround that creates a new object instead of modifying the parsed data? |
I think I got it! (lines 173 to 194)
Guess who's bad... Again: Wouldn't have happened with TypeScript code 😼
source: https://immerjs.github.io/immer/docs/freezing I guess the author of these lines knows why he used immer and how to fix this 😄 Commit: 315ff4b#diff-2f231dbdc363c929e899c94ae0d999f9886fdc6e33fb88d498a6b101a4bf9f68 @ianschmitz Your help would be appreciated |
I have come across the same issue, I triaged it the exact same way all the way down to I think the easiest solution here is to just not use immer... It's creating an immutable data structure, but then following code attempts to mutate it 🤷♂️. |
This resolves the issue, although removes the reason to use immer... Plop this at the top of the file.
|
But maybe this causes other issues. I guess there's reason why @ianschmitz introduced immer there. |
@benneq just to be clear, you might want to update the title of this issue, I have verified:
I think this is a critical bug for anyone trying to migrate over. |
@NearHuscarl Unfortunately this temporary fix only works if at the end of the day you are using the default TS config in your project. Our project brakes because we use |
having the same problem, with TS 4.1.0-beta,
|
For anyone looking for a more reliable work around for the time being, that doesn't consist on deleting the tsconfig file or manually changing the content of the faulty file every time dependencies are updated, here is what I did:
const rplce = require('line-replace')
const path = require('path')
const filePath = path.join(
__dirname,
'../node_modules/react-scripts/scripts/utils',
'verifyTypeScriptSetup.js',
)
rplce({
file: filePath,
line: 238,
text: " } else if (parsedCompilerOptions[option] !== valueToCheck && option !== 'jsx') {",
callback: ({ file, error }) => {
if (error) return console.error(error)
console.log(`Replaced ${file} successfuly!`)
}
}) So your script should look something like this: {
"start": "node fix-cra.js && react-scripts start"
} |
Message Error: Cannot use JSX unless '--jsx' flag is provided Issue: facebook/create-react-app#9868
This solution is work for me too. |
Tried this configuration in container running node:12.20.0-alpine3.10 and works! |
maybe the package.json should be ^4.0.0 instead of 4.0.0 |
you can delete tsconfig.json , npm run start . The project will create new tsconfig.json file . |
This doesn't change anything as the new tsconfig created by react-scripts is doomed, too. I'd say it's a blocker for any newcommer to the CRA and react developement in general. |
update to react-scripts 4.0.1 they fixed it, and it works now as far as I know |
- tsconfig 최초 생성 시에만 스크립트가 작동하는 문제 - facebook/create-react-app#9868
works for me too |
Still does not work with |
For some reason it does work with yarn.
|
Okay, the issue was caused by |
that sounds a solution, will give it a try! |
Yes this issue is fixed I am using In some cases you may want to remove the |
Using VS code, I had to uninstall an extension named typescript god. Closed and reopened VS code. Works fine now. Using |
Still does not work with react-scripts 4.0.2 and typescript 4.1.4. Any updates? |
I'm still gettgin this jsx issue with react-scripts=4.0.3 and typescript=4.2.3. For now I'm good with downgrading typescript. |
I solve this error updating react-scripts to 4.0.3
|
It still does not work with react-scripts 4.0.3 and typescript 4.2.4. UPDATE TSC_COMPILE_ON_ERROR=true npm start |
Describe the bug
I made a clean install of cra@next with typescript and then upgraded typescript to
4.1.0-beta
( also tested4.1.0-dev.20201023
)Error message:
( EDIT: This doesn't happen with cra 4.0.0-next.98 )
Did you try recovering your dependencies?
Yes
Which terms did you search for in User Guide?
I just looked for typescript bugs reported and closed in the last few days
Environment
System:
OS: macOS 10.15.7
CPU: (8) x64 Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz
Binaries:
Node: 14.14.0 - /usr/local/bin/node
Yarn: Not Found
npm: 6.14.8 - /usr/local/bin/npm
Browsers:
Chrome: 86.0.4240.111
Firefox: Not Found
Safari: 14.0
npmPackages:
react: ^17.0.1 => 17.0.1
react-dom: ^17.0.1 => 17.0.1
react-scripts: 4.0.0-next.117 => 4.0.0-next.117
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
npx create-react-app@next --scripts-version=@next --template=typescript@next my-ts-app
replace typescript 4.0.3 with 4.1.0-beta ( or ^4.1.0-beta ) in package.json
rm -rf node_modules package-lock.json && npm i
npm start
Expected behavior
Should work out of the box
Actual behavior
Reproducible demo
Steps are simple enough to build your own demo
The text was updated successfully, but these errors were encountered: