I'm building a react + typescript app in which I created a module with interfaces that are used all around my project's classes. My IDE resolves these interfaces fine but webpack always sends the following error. I tried different things but can't get that one to go away.
Any help would be greatly appreciated
ERROR in ./assets/src/Pages/Login.tsx Module not found: Error: Can't resolve 'seeyouftp' in 'var/www/app/assets/src/Pages'
@ ./assets/src/Pages/Login.tsx 43:18-38
@ ./assets/src/Config/App.tsx
@ ./assets/entries/bundle.js
My definition file is here
|— definitions
|— types.d.ts
|— entries
|— fonts
|— less
|— src
Excerpt of my definition file
declare module 'seeyouftp' {
interface User {
admin: boolean;
roles: string[];
username: string;
}
enum AuthStates {
success = 'success',
error = 'error'
}
tsconfig.json
{
"compilerOptions": {
"allowJs": true,
"allowUnreachableCode": false,
"baseUrl": "./assets",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"lib": [
"dom",
"es2019",
"esnext"
],
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
"noImplicitReturns": true,
"outDir": "./dist/",
"resolveJsonModule": true,
"skipDefaultLibCheck": true,
"sourceMap": true,
"strictPropertyInitialization": false,
"strictNullChecks": true,
"target": "es5",
"typeRoots": [
"./assets/definitions/types.d.ts",
"./node_modules/@types"
],
"types": [
"node"
]
},
"include": [
"./assets/src/**/*",
"./assets/definitions/**/*"
],
"exclude": [
"node_modules"
]
}
I import the created interfaces like so:
import { Item, PlayableMedia } from 'seeyouftp';
seeyouftpseeyouftpnpm package or your file? if your file, where is it located?seeyouftpis not an npm package. It's only the name of the module contained in mytypes.d.tsfile. It's declared like so:declare module 'seeyouftp'