D
D
Dmitry Kuznetsov2022-02-15 14:22:44
Node.js
Dmitry Kuznetsov, 2022-02-15 14:22:44

How to fix tslib do not define a valid '.' error target?

When using TS (recently started to move, learn it) encountered an error:

Error: Package exports for 'C:\Dev\project\packages\mod\node_modules\tslib' do not define a valid '.' target
    at resolveExportsTarget (internal/modules/cjs/loader.js:545:13)
    at applyExports (internal/modules/cjs/loader.js:459:14)
    at resolveExports (internal/modules/cjs/loader.js:508:12)
    at Function.Module._findPath (internal/modules/cjs/loader.js:577:20)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:879:27)
    at Function.Module._load (internal/modules/cjs/loader.js:785:27)
    at Module.require (internal/modules/cjs/loader.js:956:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (C:\Dev\project\packages\mod\vendor\bootstrap.js:4:17)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)


There is such a TS config:
{
  "compilerOptions": {
    /* Projects */
    "incremental": true,
    "strictPropertyInitialization": false,
    "moduleResolution": "Node",
    "importHelpers": true,

    /* Language and Environment */
    "target": "ES6",
    "experimentalDecorators": true,

    /* Modules */
    "module": "CommonJS",

    /* Emit */
    "sourceMap": false,
    "outDir": "../../packages/RP",
    "removeComments": true,

    /* Interop Constraints */
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,

    /* Type Checking */
    "strict": true,

    /* Completeness */
    "skipDefaultLibCheck": true,
    "skipLibCheck": true
  },
  "include": [
    "./**/*.ts",
    "@types/**/*.d.ts",
  ],
  "exclude": [
    "node_modules",
  ]
}

PS: This is a development on the RAGE:MP engine
PSS: The problem, most likely, is not in Typescript, most likely in Node.JS or the sequileze/typeorm library. Because a similar error occurs when these libraries are used.

What could be wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question