繁体   English   中英

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

[英]Typescript error compiling Aurelia with Intellij Idea

在使用IntelliJ Idea 2016.2时,我遇到此错误键入以编译使用生成的aurelia项目

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

无论是本地还是全局, node_modules cli显然位于node_modules中。 给定该文件应该编译的路径? 也许应该忽略?

如果我了解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开始正常

如何解决此问题,以便Idea可以正确地构建项目?

在终端中运行编译器时,您会遇到同样的问题filesGlobhttps://youtrack.jetbrains.com/issue/WEB-17991 )都不支持tsc本身支持filesGlob ,这是特定于原子的选项。 因此,所有文件都已编译。 而且,由于在项目中找不到“ aurelia-cli”的.d.ts,因此会报告编译器错误。

要解决此问题,您可以更改tsconfig.json以确保仅编译文件,或者禁用TypeScript编译器并使用aurelia来构建项目

添加generators文件夹以排除列表-Aurelia CLI在内部使用该文件夹(如果我没有记错的话)。

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

暂无
暂无

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

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