离子3 - 所有进口都是未使用的警告(即使它们被使用) [英] Ionic 3 - All imports are unused warning (even though they are being used)

查看:147
本文介绍了离子3 - 所有进口都是未使用的警告(即使它们被使用)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用以下内容运行prod构建时出现以下错误

I am getting the following error when trying to run a prod build using the following


ionic cordova build browser --prod

ionic cordova build browser --prod

在终端中收到很多警告,如

Getting lot of warnings in the terminal like


FormBuilder已声明但从未使用

FormBuilder is declared but never used

即使在我的代码中我导入并使用它,例如

Even though in my code I am importing it and using it e.g.

import { Validators, FormGroup, FormBuilder } from '@angular/forms';

public form: FormGroup;

constructor(
    private formBuilder: FormBuilder
  ) {

setForm(){
    this.form = this.formBuilder.group({
      password: ['', Validators.required],
      password2: ['', Validators.required]
    });
  }

有没有人有过类似的问题?我的猜测是与npm包更新有关。

Has anyone had a similar problem? My guess it would be something to do with an npm package update.

任何建议都会很棒。

谢谢!

推荐答案

Ionic 3.3.0(2017-05-24)删除了旧文件'src / declarations.d的用法.ts',如 changelog 。从src /文件夹中删除'declarations.d.ts'可修复未使用的导入警告。

Ionic 3.3.0 (2017-05-24) removed the usage of legacy file 'src/declarations.d.ts' as mentioned in the changelog. Removing 'declarations.d.ts' from the src/ folder fixes the unused imports warning.

有关详细信息,请查看 GitHub问题

For more info check out the GitHub issue.

这篇关于离子3 - 所有进口都是未使用的警告(即使它们被使用)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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