代码之家  ›  专栏  ›  技术社区  ›  Mohamad Shiralizadeh muhamad ridwan

我可以在typescript项目中使用CommonJS模块系统吗?

  •  0
  • Mohamad Shiralizadeh muhamad ridwan  · 技术社区  · 6 年前

    Visual Studio , 打字稿 , ASP.net核心 . 实际上,我需要一个模块系统来组织我的依赖关系。我该怎么办?

    我能用吗 在使用visualstudio的typescript项目中?

    ts配置:

    {
      "compileOnSave": true,
      "compilerOptions": {
        "noImplicitAny": false,
        "noEmitOnError": true,
        "removeComments": false,
        "sourceMap": true,
        "target": "es5",
        "module": "commonjs"
      },
      "exclude": [
        "node_modules",
        "wwwroot"
      ]
    }
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   azrahel    6 年前

    是的,您可以像在Javascript中一样使用它。

    请参阅:

    https://www.typescriptlang.org/docs/handbook/modules.html

    并搜索(ctrl/cmd+f)“require”