Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

feat(@angular-devkit/build-angular): add watch mode to server #863

Merged
merged 1 commit into from
May 30, 2018

Conversation

Toxicable
Copy link

Adds watch mode into server build

@tobi-or-not-tobi
Copy link

@Toxicable I got a notion of this PR on your talk at ng-air today - great job! I'm wondering if this is a generic solution, so it can be used for building other apps then universal as well based on file changes. I'm after a watch mode for libraries, see #730. Ideally, we can configure watch modes for specific apps/project.

@Toxicable
Copy link
Author

@tobi-or-not-tobi No this wont help with your issue sorry.
This is for Universal only, since libraries undergo a much different build/bundle process it cannot be applied to that either.

@kondi
Copy link

kondi commented May 29, 2018

Is it possible to have some explanation or info about "further discussion"? Would be good to have this option soon.

@filipesilva
Copy link
Contributor

@kondi we discussed this last friday and I think this PR is good to get in as is.

@clydin clydin merged commit f562226 into angular:master May 30, 2018
@Toxicable Toxicable deleted the server-watch branch June 1, 2018 20:50
@mgol
Copy link
Member

mgol commented Jun 5, 2018

It doesn't seem to be working correctly for me with @angular-devkit/build-angular 0.7.0-beta.1. Under my project's architect key I have the server target defined as follows:

"server": {
  "builder": "@angular-devkit/build-angular:server",
  "options": {
    "outputPath": "dist/server",
    "main": "src/main.server.ts",
    "tsConfig": "src/tsconfig.server.json",
    "watch": true
  }
}

There is no error when I run:

ng run phoenix:server

it compiles but it then exits immediately, not entering watch mode.

For comparison, watch works correctly for the browser part which has the following specified:

"builder": "@angular-devkit/build-angular:browser"

@mgol
Copy link
Member

mgol commented Jun 6, 2018

Comparing the code of the browser and server parts I see that the browser one doesn't complete the observable in watch mode:
https://github.com/angular/devkit/blob/v6.1.0-beta.1/packages/angular_devkit/build_angular/src/browser/index.ts#L111
while the server one has no special logic for watch here:
https://github.com/angular/devkit/blob/v6.1.0-beta.1/packages/angular_devkit/build_angular/src/server/index.ts#L84
Can that be a problem?

@Toxicable
Copy link
Author

@mgol Yup it was the problem, just needed a simple check.
Should be fixed in the version that was just released

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants