Migrate your build scripts for sexy Angular SSR

feet in between two arrows going the opposite direction

If you’re migrating build scripts from an older project into one that uses Angular 17+, you might run into the error:

Project target does not exist.

Why it happens

Angular 17 no longer has a separate build command for SSR! Also, it will complain if you try to use the –production flag.

The fix

In package.json, remove the script with ‘build:ssr’ as the key. It will be located under ‘scripts’:

"scripts": {
  "build:ssr": ".." -- you need to delete this key-value pair
}

Prerendering

As a bonus, Angular will also run the prerender command automatically when it builds. (It’s a setting in angular.json if you want to change it.)


Discover more from Cloud Engineering Studio

Subscribe to get the latest posts sent to your email.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *