How to delete unused html pages in ionic 2?

How to i delete unused component and html files? If i delete in that page again run error.

**Runtime Error**
**Cannot find module "../profile/profile"**
Error: Cannot find module "../profile/profile"
    at g (http://localhost:8102/build/polyfills.js:3:7133)
    at Object.<anonymous> (http://localhost:8102/build/main.js:109113:7)
    at __webpack_require__ (http://localhost:8102/build/main.js:20:30)
    at Object.<anonymous> (http://localhost:8102/build/main.js:109225:99)
    at __webpack_require__ (http://localhost:8102/build/main.js:20:30)
    at Object.__webpack_exports__.a (http://localhost:8102/build/main.js:60495:77)
    at __webpack_require__ (http://localhost:8102/build/main.js:20:30)
    at Object.<anonymous> (http://localhost:8102/build/main.js:108497:75)
    at __webpack_require__ (http://localhost:8102/build/main.js:20:30)
    at Object.<anonymous> (http://localhost:8102/build/main.js:82133:73)
    at __webpack_require__ (http://localhost:8102/build/main.js:20:30)
    at Object.<anonymous> (http://localhost:8102/build/main.js:121645:70)
    at __webpack_require__ (http://localhost:8102/build/main.js:20:30)
    at http://localhost:8102/build/main.js:66:18
    at http://localhost:8102/build/main.js:69:10

Ionic Framework: 3.0.1
Ionic App Scripts: 1.3.0
Angular Core: 4.0.0
Angular Compiler CLI: 4.0.0
Node: 6.10.2
OS Platform: Linux 4.8
Navigator Platform: Linux x86_64
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/57.0.2987.98 Chrome/57.0.2987.98 Safari/537.36

How to delete my unused folders html,ts files.

search your project for this statement.
You are importing this file somewhere e.g. in the app module

What did you delete, “profile”?
If so, you also need to remove all imports of this Component from your other code.

1 Like

i create one component in ionic command. For example ionic g page profile

I delete that folder. I removed that page names in app.module.ts also. i get it same error

This makes no sense. Are you creating components/pages (this post) or are you deleting them (first post)?

After adding the page and deleting the page, did you stopped and started your local dev server and restarted it again with ionic serve? Sometimes the page is still builded somewhere.

I created folder include ts,html.scss files using ionic g page profile .But i did,t used this files in my project. Now i want to delete this folder include that files. But when i delete that folder i getting error.

yes i stop my ionic local server and delete unused folder then start my server also getting same error. I clear all browser history and restart my system after delete that folder also i am getting same error?

You have to get rid of all imports and then rebuild your app.

So, remove all those imports as @Sujan12 says. Probably one is still somewhere around. After that, make sure you build the whole bunch again.

OK Thanks for reply @Sujan12 and @luukschoen … i will check once again and will update.

imported that profile file in some other component . i delete it now working fine …thank you @Sujan12 ,@luukschoen and @bengtler

1 Like

A post was split to a new topic: How do you remove add-teacher.html?