My TypeScript webpack project was struggling to resolve all custom paths today for some unknown reason. Despite trying various solutions such as re-installing packages and modifying settings, the issue persists. The same error is displayed for all files.
I have verified that my ts-config
"moduleResolution": "node"
is correctly configured.
ts-config.json
{
"compilerOptions": {
"target": "es5",
"module": "CommonJS",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"allowJs": true,
"noImplicitAny": false,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": ".",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost",
"es2016",
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": [
"node_modules"
]
}
package.json
{
"scripts": {
"test": "exit 0;",
"build": "cross-env NODE_ENV=production webpack",
"serve": "cross-env NODE_ENV=development webpack serve"
},
"devDependencies": {
// List of dev dependencies...
},
"peerDependencies": {
// Peer dependencies...
},
"dependencies": {
// List of external dependencies...
}
}
Have you considered any other potential causes for the sudden inability to locate all paths? I have even reverted my git status to a previous state where everything was working fine and reinstalled all the necessary packages, but the problem remains unresolved.