Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop Ionic VS Code extension automatically adding import statement

Each time I save a .html file in my angular app, the Ionic extension adds this line to the corresponding .ts file: import { addIcons } from "ionicons";

While, I do use Ionic in other app I develop, the current app I am working on is not using Ionic. Here is the package.json

{
  "name": "xxx",
  "version": "0.0.1",
  "scripts": {
    "ng": "ng",
    "build": "build:development",
    "watch": "ng build --watch --configuration development",
    "start": "ng serve --configuration=development",
    "start:production": "ng serve --configuration=production",
    "build:development": "ng build --configuration=development --base-href=./ --aot --optimization",
    "build:production": "ng build --configuration=production --output-path=Client/ --base-href=./ --aot --optimization",
    "test": "ng test"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^18.1.0",
    "@angular/cdk": "^18.1.3",
    "@angular/common": "^18.1.0",
    "@angular/compiler": "^18.1.0",
    "@angular/core": "^18.1.0",
    "@angular/forms": "^18.1.0",
    "@angular/material": "^18.1.3",
    "@angular/platform-browser": "^18.1.0",
    "@angular/platform-browser-dynamic": "^18.1.0",
    "@angular/router": "^18.1.0",
    "rxjs": "~7.8.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.14.3"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^18.1.3",
    "@angular/cli": "^18.1.3",
    "@angular/compiler-cli": "^18.1.0",
    "@types/jasmine": "~5.1.0",
    "jasmine-core": "~5.1.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.2.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.1.0",
    "typescript": "~5.5.2"
  }
}

It looks like I have the Ionic v1.93.1 installed.

I am using angular 18 and material, somehow I guess Ionic thinks mat-icon is an ionic component and thus adds the import statement.

I've looked at the ionic settings in vs code and nothing is available to stop this feature.

Please let me know if there is a way to stop this (without uninstalling or disabling the Ionic extension).

like image 710
M H Avatar asked Nov 17 '25 17:11

M H


1 Answers

I had this problem and it was caused by de 'official ionic extension'. I just disabled the plugin and the problem was solved (I was not in a ionic project).

like image 95
Edvan Souza Avatar answered Nov 20 '25 06:11

Edvan Souza



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!