create-react-app
create-react-app copied to clipboard
Is "app" folder name reserved when aliasing in typescript?
trafficstars
TS compiler says module not found when I added the app path alias in tsconfig file.

it works whenever there is no app folder in the paths.
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"baseUrl": "./src",
"paths": {
"modules/*": ["modules/*"], //works fine
"app_core/*": ["app/core/*"], //does not work
"core/*": ["core/*"] //works fine
}
},
"include": ["src"]
}
when I use the app_core module the compiler says module not found
import TestModule from "app_core/test/Test.module"; //doesnot work
import TestModule1 from "core/test/Test.module"; //works fine
import PageModule from "modules/Page.module"; //works fine
import React from "react";
import "./App.css";
function App() {
return (
<div className="App">
<TestModule />
<TestModule1 />
<PageModule />
</div>
);
}
export default App;
Edit:
Folder structure

I don't know if the folder name is reserved or something. Can someone help me out? Thank you in advance.
There is currently an issue with path aliases 😔
Which means that react-scripts will ignore your paths configuration
see #12047