-
Notifications
You must be signed in to change notification settings - Fork 429
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 following changes are being made to your tsconfig.json file #375
Comments
I assume (since you didn't actually write a question) that you're trying to use absolute paths. Try the suggestions here: facebook/create-react-app#5645 (comment) - if having those two settings in a differently named tsconfig file that gets imported stops react-scripts from removing them, you're all good (and can ignore that react-scripts still complains at you). Current state of potential implementation (currently for baseUrl only, aliases to follow later once they've worked out what they will support) for CRA: facebook/create-react-app#6656 Being able to set those is currently targetted for CRA 3 - https://github.com/facebook/create-react-app/projects/6 . The spot where react-scripts overwrites the values in your tsconfig.json file is not one that react-app-rewired can currently modify (it happens outside of the webpack configurations). One other possibility is to use a library called patch-package to modify the diff --git a/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js b/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js
index fa4b5c8..13c81b5 100644
--- a/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js
+++ b/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js
@@ -124,10 +124,10 @@ function verifyTypeScriptSetup() {
// We do not support absolute imports, though this may come as a future
// enhancement
baseUrl: {
- value: undefined,
+ suggested: '.',
reason: 'absolute imports are not supported (yet)',
},
- paths: { value: undefined, reason: 'aliased imports are not supported' },
+ paths: { suggested: { 'src/*': ['src/*'] }, reason: 'aliased imports are not supported' },
};
const formatDiagnosticHost = { Note that none of these suggestions can be done via react-app-rewired - this is one area where other tools are more appropriate. |
After changing, can't I start with react-app-rewired + customize-cra? |
What I meant was that stopping React-app-rewired can be used to start/build the project afterwards, it just is not able to stop that file from being modified by react-scripts. |
@XianZhengquan You have a typo at the end of the "paths" line in your react-scripts patch - two closing brackets when there should be one. And you're missing the closing bracket in the suggested object of the same line (i.e. one of those extra brackets at the end should be before the comma for the reason message). // You have:
paths: { suggested: { '@/*': ['src/*'], reason: 'aliased imports are not supported' }},
// It should be:
paths: { suggested: { '@/*': ['src/*'] }, reason: 'aliased imports are not supported' }, |
@dawnmist sorry,I modified it, but still can't start the project.can you give me your email, easy to contact?This is my mail box |
add paths.json on dir root
tsconfig.json
config-override.js
can solve it. |
This is closed, but for anyone looking for this issue in the future, I found that for local dev, the solution is to add our aliases to the webpage An example:
All this information I found was by @gustavograeff1998 at medium, in this Source. |
The following changes are being made to your tsconfig.json file:
The text was updated successfully, but these errors were encountered: