小编bha*_*hiv的帖子

使用 Typescript 在 Nodejs 中导入语句在编译后不会使用绝对路径解析

我正在尝试使用 Typescript 在 NodeJs 中编写服务器。我已经安装了这些devDependencies

    "@types/config": "^0.0.38",
    "@types/express": "^4.17.12",
    "@types/jsonwebtoken": "^8.5.1",
    "@types/lodash": "^4.14.170",
    "@types/morgan": "^1.9.2",   

    "nodemon": "^2.0.7",
    "tslint": "^6.1.3",
    "typescript": "^4.3.2"
Run Code Online (Sandbox Code Playgroud)

我的tsconfig.json是这样的:

{
  "compilerOptions": {
    /* Visit https://aka.ms/tsconfig.json to read more about this file */

    /* Basic Options */
    // "incremental": true,                         /* Enable incremental compilation */
    "target": "es5",                                /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */
    "module": "commonjs",                           /* Specify module code generation: 'none', 'commonjs', …
Run Code Online (Sandbox Code Playgroud)

javascript node.js typescript webpack babeljs

13
推荐指数
2
解决办法
9507
查看次数

标签 统计

babeljs ×1

javascript ×1

node.js ×1

typescript ×1

webpack ×1