First of all, I'm super happy that Nx supports node-apps! Been waiting for this and super pleased with it.
Yesterday I tried to upgrade my project to Angular 7, and it seems like this broke properly serving the node-app using ng serve.
I understand that Angular 7 might not be supported yet, but I figured it would be good to get this issue out, other people will probably encounter the same issues and search for it :)
# Create new workspace
create-nx-workspace beeman
# Create a node-app
ng g node-api api
# Start the node-app
ng serve api
The default app gets served and listens on port 333:
Starting type checking service...
Using 6 workers with 2048MB memory limit
Type checking in progress...
Hash: 0ad7224d6b0f94552a33
Version: webpack 4.21.0
Time: 649ms
Built at: 10/20/2018 4:42:36 PM
Asset Size Chunks Chunk Names
main.js 5.09 KiB main [emitted] main
Entrypoint main = main.js
[./apps/api/src/main.ts] 465 bytes {main} [built]
[express] external "express" 42 bytes {main} [built]
[0] multi ./apps/api/src/main.ts 28 bytes {main} [built]
Debugger listening on ws://127.0.0.1:9229/1a5f4fc4-4123-4f1f-9d93-ecbc639ef090
For help, see: https://nodejs.org/en/docs/inspector
Listening at http://localhost:3333
No type errors found
Version: typescript 2.9.2
Time: 3479ms
However, after upgrading Angular to the latest version (using ng update @angular/cli @angular/core), this somehow stops working:
Starting type checking service...
Using 6 workers with 2048MB memory limit
Type checking in progress...
Hash: 7d25687415eb0018bb35
Version: webpack 4.9.2
Time: 663ms
Built at: 10/20/2018 4:44:16 PM
Asset Size Chunks Chunk Names
main.js 4.13 KiB main [emitted] main
Entrypoint main = main.js
[./apps/api/src/main.ts] 465 bytes {main} [built]
[express] external "express" 42 bytes {main} [built]
[0] multi ./apps/api/src/main.ts 28 bytes {main} [built]
No type errors found
Version: typescript 3.1.3
Time: 3590ms
The app gets build, but never starts listening.
My (sort of) workaround is to start the node-app in build mode with watcher, then use nodemon to serve version from ./dist. This does however not reload the API when one of the libraries changes, so it's half a workaround :)
ng build api --watch
nodemon dist/apps/api/main
I got a demo repo here: https://github.com/beeman/beeman-nx-workspace
Thanks @beeman, V7 support is coming soon and this is confirmed to be working! ;)
Most helpful comment
Thanks @beeman, V7 support is coming soon and this is confirmed to be working! ;)