When I am running my webpack dev server, Typescript is generating this error:
ERROR in ./src/components/allowcated-resources/AllowcatedResources.tsx
Module not found: Error: Can't resolve 'my-scheduler' in 'mypath\allowcated-resources'
@ ./src/components/allowcated-resources/AllowcatedResources.tsx 3:0-41 77:20-28
@ ./src/components/App.tsx
@ ./src/index.tsx
@ multi ./src/index.tsx
This is the content of my tsconfig file:
{
"compilerOptions": {
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"allowSyntheticDefaultImports": true,
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"jsx": "react",
"module": "ESNext",
"moduleResolution": "node",
"noImplicitAny": false,
"target": "es5",
"sourceMap": true,
"lib": ["es6", "dom"],
"typeRoots": ["./node_modules/@types", "./typings"],
"baseUrl": ".",
"paths": {
"my-scheduler": ["typings/my-scheduler"]
},
"plugins": [
{
"name": "typescript-tslint-plugin",
"alwaysShowRuleFailuresAsWarnings": false,
"ignoreDefinitionFiles": true,
"configFile": "./tslint.json",
"suppressWhileTypeErrorsPresent": false
}
]
},
"include": ["./src/**/**/*"],
"exclude": ["node_modules", "typings"]
}
I have a directory named 'typings' in the root folder and it contains 'typings/my-scheduler/index.d.ts'
The content of index.d.ts file is as follows:
declare module 'my-scheduler' {
// export members
export class TimeSpan { // }
}
Even though I can locate this typing by clicking on vs code import,
import { TimeSpan } from 'my-scheduler';
However, when I run the web pack server, it gives me the following error:
Module not found: Error: Can't resolve 'my-scheduler'
What could be causing this issue?