0

I'm working on an Angular 4 project using Angular CLI but it's recompiling everything time there is any change on any folder on the project I'm working on.

For example, I'm working on a file uploader and I can't properly test it, because when a file is uploaded, the app is recompiled and reloads, so the function never finishes.

Is there a way to prevent this to happen? It would be ideal to just disable the "watch" on a single folder, which is the assets folder.

I tried to remove it from the angular-cli.json file but it made no difference, it's still recompiling everything.

I also tried to add an exclude option to the files tsconfig.json and tsconfig.app.json but it's also still recompiling everything.

I added the exclude like this:

// tsconfig.app.json
"exclude": [
    "test.ts",
    "**/*.spec.ts",
    "/app/assets/**/*"
]

// tsconfig.json
"exclude": [
    "test.ts",
    "**/*.spec.ts",
    "./src/app/assets/**/*"
]
celsomtrindade
  • 4,501
  • 18
  • 61
  • 116

1 Answers1

0

Similar to: Angular 2 - Exclude files from build

You can use ng eject to get the webpack.config.js. You can modify this to your needs. However, you will not be able to use ng serve or ng build after that.

For using these commands again, you have to modify .angular-cli.json. Remove the property 'projects.ejected' or set it to false. https://stackoverflow.com/questions/42984558/how-to-undo-angular-2-cli-ng-eject

Sachin Gupta
  • 4,981
  • 3
  • 16
  • 32