Answer the question
In order to leave comments, you need to log in
How to specify default extension to import index.ts in Create React App?
The question is, I import react components through index.js, the import is specified without an extension, that is, I first make a component and then import it into index.js and immediately export it, it works fine with js files, but when switching to ts, if I replace it with index.ts, then import flies because react is looking for a file with a js or json extension.
As I understand it, you need to expand the webpack config and enter there
<code>resolve: {
extensions: ['.js', '.json', '.ts']</code>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question