TypeError: this.CliEngine is not a constructor

 

vue cli3 项目老是提示TypeError: this.CliEngine is not a constructor这个,看着特别扭

解决方法也不难,直接点击Details
在这里插入图片描述
然后再点击,如下第一个文件链接
在这里插入图片描述
找到如下方法

  function ESLintPlugin(state) {
        this.filterSource = state.filterSource;
        this.additionalRulesDirectory = state.additionalRootDirectory;
        this.calcBasicPath(state.eslintPackagePath);
        this.version = this.readVersion();
        if (this.initError == null) {
            this.linter = require(this.basicPath + "lib/cli.js");
            this.options = require(this.basicPath + "lib/options");
            this.CliEngine = require(this.basicPath + "lib/cli-engine");
        }
    }

 

this.CliEngine = require(this.basicPath + "lib/cli-engine"); 更改为 this.CliEngine = require(this.basicPath + "lib/cli-engine").CLIEngine;

然后重启webstorm

posted @ 2020-02-12 14:55  奔跑的痕迹  阅读(13518)  评论(1编辑  收藏  举报