Answer the question
In order to leave comments, you need to log in
How to make React + Typescript aliases work in VSCODE?
Used by webpack 5.
my tsconfig
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"sourceMap": true,
"strict": true,
"esModuleInterop": true,
"resolveJsonModule": true
},
"baseUrl": "src",
"paths": {
"@pages": [
"pages/*"
]
},
"include": [
"src"
]
}
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
alias: {
'@pages': path.resolve(__dirname, 'src/pages')
},
},
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