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

Fix for TypeScript issues with yarn start #52036

Merged
merged 1 commit into from May 24, 2023

Conversation

sanchitmalhotra126
Copy link
Contributor

This is a tentative fix for some intermittent issues we've been seeing with TypeScript and running yarn start. Specifically, we've noticed that occasionally TypeScript will fail to recognize the @cdo/apps path defined in tsconfig.json, saying the file does not exist, but only when running yarn start. When this occurs, we've noticed that yarn build succeeds.

The fix here is to remove the ts task from the list of watch tasks run during yarn start. I believe this was causing some issues where TypeScript was getting built too early/out of sync, and the webpack:watch step should take care of compiling TypeScript anyway.

I've also included some small test changes which updates JS import paths in a .tsx file from require to import. These changes were initially failing to build for me, but after updating the Gruntfile, they build successfully.

Links

https://codedotorg.atlassian.net/browse/SL-861

Testing story

Tested locally by first running yarn clean and manually deleting the .tscache folder. Then separately ran both yarn build and yarn start and confirmed that there were no build issues, and new changes were building.

@sanchitmalhotra126 sanchitmalhotra126 requested review from molly-moen and a team May 23, 2023 16:25
@ebeastlake
Copy link
Contributor

This change seems reasonable to me. I defer to @molly-moen for final approval!

Copy link
Contributor

@molly-moen molly-moen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@sanchitmalhotra126 sanchitmalhotra126 merged commit 26e9df8 into staging May 24, 2023
2 checks passed
@sanchitmalhotra126 sanchitmalhotra126 deleted the sanchit/ts-yarn-start branch May 24, 2023 00:09
@breville
Copy link
Member

and the webpack:watch step should take care of compiling TypeScript anyway.

Totally out of curiosity, where is this code that is doing the TypeScript compiling?

@sanchitmalhotra126
Copy link
Contributor Author

sanchitmalhotra126 commented May 25, 2023

Totally out of curiosity, where is this code that is doing the TypeScript compiling?

@breville I believe in our Webpack base config here. According to Webpack, ts-loader uses tsc (the TypeScript compiler)

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

Successfully merging this pull request may close these issues.

None yet

4 participants