简体   繁体   中英

TypeScript 4.5: Module not found importing local file

I have a node express based application with the following tsconfig:

{
  "compilerOptions": {
    "lib": [ "es6", "es2021", "esnext" ],
    "target": "esnext",
    "module": "es2022",
    "composite": true,
    "declaration": true,
    "declarationMap": true,
    "forceConsistentCasingInFileNames": true,
    "importHelpers": true,
    "newLine": "LF",
    "noFallthroughCasesInSwitch": true,
    "noImplicitReturns": true,
    "noUncheckedIndexedAccess": true,
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "preserveConstEnums": true,
    "removeComments": true,
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "noImplicitAny": true,
    "moduleResolution": "Node",
    "sourceMap": false,
    "rootDir": "./src",
    "outDir": "./dist",
    "baseUrl": "./src",
    "paths": {
      "*": [
        "node_modules/*"
    ]
}

The got package on github has a pretty handy \/ nifty guide<\/a> on converting from commonjs to ESM, for both js and TypeScript:

it's working and I have encountered a different problem which will raise a new question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM