简体   繁体   English

使用Intellij Idea编译Aurelia的打字稿错误

[英]Typescript error compiling Aurelia with Intellij Idea

Using IntelliJ Idea 2016.2 I'm encountering this error typing to compile an aurelia project generated with 在使用IntelliJ Idea 2016.2时,我遇到此错误键入以编译使用生成的aurelia项目

aurelia_project/generators/binding-behavior.ts(2,52): error TS2307: Cannot find module 'aurelia-cli'.

aurelia cli is plainly in node_modules for both local and global. 无论是本地还是全局, node_modules cli显然位于node_modules中。 Given the path should this file even compile? 给定该文件应该编译的路径? perhaps it should be ignored? 也许应该忽略?

if I understand tsconfig and my idea settings, these shouldn't even be built 如果我了解tsconfig和我的想法设置,这些甚至都不应构建

{
  "compileOnSave": false,
  "compilerOptions": {
    "sourceMap": true,
    "target": "es5",
    "module": "amd",
    "declaration": false,
    "noImplicitAny": false,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "lib": ["es2015", "dom"]
  },
  "exclude": [
    "node_modules"
  ],
  "filesGlob": [
    "./src/**/*.ts",
    "./test/**/*.ts",
    "./typings/index.d.ts",
    "./custom_typings/**/*.d.ts"
  ],
  "atom": {
    "rewriteTsconfig": false
  }
}

想法设定

au run --watch starts fine au run --watch开始正常

How can I fix this issue so that Idea can build the project without errors? 如何解决此问题,以便Idea可以正确地构建项目?

Your will get the same issue when running the compiler in terminal - neither Idea ( https://youtrack.jetbrains.com/issue/WEB-17991 ) not tsc itself support filesGlob , this is atom-specific option. 在终端中运行编译器时,您会遇到同样的问题filesGlobhttps://youtrack.jetbrains.com/issue/WEB-17991 )都不支持tsc本身支持filesGlob ,这是特定于原子的选项。 So all files are compiled. 因此,所有文件都已编译。 And, as no .d.ts for 'aurelia-cli' can be found in the project, compiler errors are reported. 而且,由于在项目中找不到“ aurelia-cli”的.d.ts,因此会报告编译器错误。

to work out the issue, you can either change the tsconfig.json to make sure that only need files are compiled, or disable TypeScript compiler and use aurelia to build your project 要解决此问题,您可以更改tsconfig.json以确保仅编译文件,或者禁用TypeScript编译器并使用aurelia来构建项目

Add generators folder to exclude list - that folder is used internally by Aurelia CLI(if i remember correctly). 添加generators文件夹以排除列表-Aurelia CLI在内部使用该文件夹(如果我没有记错的话)。

"exclude": [
  "node_modules",
  "aurelia_project"
],

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM