Cannot find module with Webpack, Typescript, custom module directory
By : siam sam hossain
Date : March 29 2020, 07:55 AM
hope this fix your issue I found an easier solution than the previously accepted one: In your typescript configuration, set the baseUrl in the compilerOptions: code :
{
"compilerOptions": {
"baseUrl": "./app",
...
},
...
}
|
TypeScript can't find module flatpickr, even though it includes typescript types
By : Mindaugas Steponavič
Date : March 29 2020, 07:55 AM
To fix this issue Your tsconfig.json uses "module": "es6". According to the compiler options definition, this causes the compiler to lookup modules in a classic manner. The classic lookup works for some scenarios but does not support node modules defined via packages.json, which is the case for flatpickr. What you need to change for this to work for you is either set the tsconfig.json to "moduleResolution": "node" or perhaps use "module": "commonjs" which will switch both the emitted modules and resolution mechanism to node.js standards.
|
Node Error: Cannot find module - typescript api for custom module where I export mongoose schemas and interfaces
By : user2918548
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further I have a typescript module @tlabs/models where I'm simply exporting in index.ts: , My final TS config for my exported models: code :
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"outDir": "lib",
"strict": true,
"esModuleInterop": true
},
"include": ["src"]
}
{
"main": "lib/index.js",
"types": "lib",
"scripts": {
"tsc": "tsc",
"build": "tsc -p ."
},
"files": [
"lib"
],
}
|
Nuxt TypeScript error: nuxt:typescript Cannot find module '@/my-module'
By : user3312233
Date : March 29 2020, 07:55 AM
Hope that helps I found the solution here: https://github.com/nuxt/typescript/issues/153#issuecomment-543010838Basically, create a ts-shim.d.ts in your root directory with these contents: code :
declare module '*.vue' {
import Vue from 'vue';
export default Vue
}
{
"compilerOptions": {
...
"baseUrl": ".",
"paths": {
"~/*": ["./*"],
"@/*": ["./*"]
}
}
}
import SomeComponent from '~/components/SomeComponent.vue'
|
TypeScript - module.exports throws error TS2591: Cannot find name 'module'
By : user3627444
Date : March 29 2020, 07:55 AM
|