打字稿:--outDir 似乎不起作用 [英] Typescript: --outDir does not seem to work

查看:41
本文介绍了打字稿:--outDir 似乎不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 vs2015 中使用 typescript,我的项目中有以下结构:

I am using typescript in vs2015 and I have the following structure in my project:

in my wwwroot
           app - it containts some ts files
           lib
               spa - this is where I want all my compiled js to be

我的应用程序目录中有一个 tsconfig.json,其值如下:

There is a tsconfig.json in my app directory with the following values:

{
  "compilerOptions": {
    "noImplicitAny": true,
    "module": "system",
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "es5",
    "outDir": "../lib/spa"
  }
}

我已经设置了 vs2015 来在保存时编译我的 ts 文件.但是编译后的 js 文件是在同一个应用程序目录中生成的,而不是在所需的/lib/spa 文件夹中.建议?

I have set up vs2015 to compile my ts files on save. But the compiled js files are generated in the same app dir, and not in the desired /lib/spa folder. Suggestions ?

推荐答案

在低于 1.8 的 TypeScript 版本中,out 选项不能与 module 选项一起使用.

In TypeScript versions lower than 1.8 the out option does not work together with the module option.

您可以在此处检查问题.

在 1.8 版中,当模块选项为 amdsystem 时,您将能够使用 out.

In version 1.8 you will be able to use out when the module option is amd or system.

您现在可以使用 typescript@next 版本的 TypeScript 并利用该功能.要安装它,请运行:

You can use the typescript@next version of TypeScript and make use of the feature now. To install it run:

$ npm install -g typescript@next

这篇关于打字稿:--outDir 似乎不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆