更改tsconfig.app.json

时间:2018-02-23 22:47:35

标签: angular typescript command-line-interface angular-cli

我可以更改文件tsconfig.app.json和tsconfig.spec.json的位置吗?我想将这些文件放在src/config文件夹中。但是我试试,终端给我看错了。

版本

Windows 10
NPM 5.6.0
Node 6.11.4
NG 5.2

Repro步骤

  • 将文件tsconfig.app.json放入配置文件夹
  • tsconfig.jsonextends的位置更改为tsconfig.app.json
  • 运行项目开始

观察到的行为

返回错误:

ERROR in TypeError: Cannot read property 'length' of undefined
    at createSourceFile (C:\Users\bruno.dulcetti\Repositorios\tfs\_componentes\Base.Template.Angular\node_modules\typescript\lib\typescript.js:12619:109)
    at parseSourceFileWorker (C:\Users\bruno.dulcetti\Repositorios\tfs\_componentes\Base.Template.Angular\node_modules\typescript\lib\typescript.js:12551:26)
    at Object.parseSourceFile (C:\Users\bruno.dulcetti\Repositorios\tfs\_componentes\Base.Template.Angular\node_modules\typescript\lib\typescript.js:12477:26)
    at Object.createSourceFile (C:\Users\bruno.dulcetti\Repositorios\tfs\_componentes\Base.Template.Angular\node_modules\typescript\lib\typescript.js:12318:29)
    at new TypeScriptFileRefactor (C:\Users\bruno.dulcetti\Repositorios\tfs\_componentes\Base.Template.Angular\node_modules\@ngtools\webpack\src\refactor.js:79:35)
    at Object.resolveEntryModuleFromMain (C:\Users\bruno.dulcetti\Repositorios\tfs\_componentes\Base.Template.Angular\node_modules\@ngtools\webpack\src\entry_resolver.js:108:20)
    at Promise.resolve.then.then (C:\Users\bruno.dulcetti\Repositorios\tfs\_componentes\Base.Template.Angular\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:255:54)
    at process._tickCallback (internal/process/next_tick.js:109:7)
    at Module.runMain (module.js:606:11)
    at run (bootstrap_node.js:383:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:496:3

我的档案tsconfig.app.json

{
    "extends": "../../tsconfig.json",
    "compilerOptions": {
        "outDir": "../../out-tsc/app",
        "baseUrl": "../",
        "module": "es2015",
        "types": []
    },
    "exclude": [
        "test.ts",
        "../**/*.spec.ts"
    ]
}

期望的行为

我没有使用CLI。

问候。

1 个答案:

答案 0 :(得分:0)

我想您可以尝试在项目的根文件夹中的.angular-cli.json中的应用程序定义中将路径/名称更改为tsconfig.app.json

相关问题