I keep typescript react components in different files, so I use the following statement to import my sub components.
//app.tsx
import {SideBar} from "./sidebar"
But when typescript compiles app.tsx to app.jsx, the import statement switches to require("sidebar"). I get an error on the javascript as the require statement needs to have "sidebar.jsx" with ".jsx" extension. Is there a way I could automate that?
My tsconfig setting is :
{
"compilerOptions": {
"jsx": "preserve",
"target": "ES5",
"noImplicitAny":false,
"module": "commonjs",
}
}
Maybe I need to add something to the tsconfig file?
Thanks in advance.
.tsxfiles in a separate folder, entirely?