0

I have faced to a wired problem while I am using my ionic 2 application. when I hit ionic serve command it starts the server on localhost. here is the result

[12:00:45]  ionic-app-scripts 0.0.45 
[12:00:46]  watch started ... 
[12:00:46]  build dev started ... 
[12:00:46]  clean started ... 
[12:00:46]  clean finished in 31 ms 
[12:00:46]  copy started ... 
[12:00:46]  transpile started ... 
[12:00:52]  transpile finished in 6.08 s 
[12:00:52]  webpack started ... 
[12:00:53]  copy finished in 6.93 s 
[12:01:03]  webpack finished in 10.36 s 
[12:01:03]  sass started ... 
[12:01:04]  sass finished in 1.61 s 
[12:01:04]  build dev finished in 18.14 s 
[12:01:05]  watch ready in 18.62 s 
[12:01:05]  dev server running: http://localhost:8100/ 

here are my script configurations in package.json file

"scripts": {
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },

but If I changed some .ts file and saved it, then the ionic server doesn't detect that change. I have to go to terminal and enter ctrl+c and restart the server with ionic serve command for every change that I do.

But my current working branch is correctly running on other computers.They don't face this issue. So I reinstall the ionic 2 and npm ,also I cleared cache file according to this (How do you completely remove Ionic and Cordova installation from mac?). But it doesn't fix the problem. But if I run another application, then it runs correctly and detects my save changes automatically.

Now I can't understand what is going wrong. anyone has an idea about this. Thanks.

Community
  • 1
  • 1
Dilanka Rathnayake
  • 660
  • 2
  • 11
  • 32

2 Answers2

3

If your file path of the ionic app has unnecessary characters (blank, slash, etc), Then watches get wired at the compile time. So avoid them. use only underscore for the string separation. Then can overcome this problem :)

Dilanka Rathnayake
  • 660
  • 2
  • 11
  • 32
0

My scripts in the packege.json working fine, you can try them:

"scripts": {
    "build": "ionic-app-scripts build",
    "watch": "ionic-app-scripts watch",
    "serve:before": "watch",
    "emulate:before": "build",
    "deploy:before": "build",
    "build:before": "build",
    "run:before": "build"
  },
Bünyamin Sarıgül
  • 3,031
  • 4
  • 30
  • 55