Upgrade JSS apps to JSS 21.6
Sitecore JavaScript Rendering SDKs version 21.6 brings changes to JSS packages, other NPM dependencies, and some environment variables.
-
Familiarize yourself with the JSS 21.6 release notes.
This topic shows you how to:
-
Upgrade dependencies and environment variables in React and Vue apps.
-
Upgrade JSS Next.js apps to JSS 21.6.
-
Upgrade JSS Angular apps to JSS 21.6 and Angular 16.
Upgrade dependencies and environment variables in React and Vue apps
Upgrading your applications based on JSS templates requires upgrading your dependencies and replacing some environment variable names.
To upgrade your applications:
-
In your
package.jsonfile, update every@sitecore-jssdependency to use the~21.6.0version. -
Rename your application's
JSS_APP_NAMEenvironment variable toSITECORE_SITE_NAME. -
If your application is a React or Next.js app, update the
@types/reactdependency to version^18.2.22. -
In a shell, install/update dependencies in your app by running the following command:
Upgrade JSS Next.js apps to JSS 21.6
In JSS 21.6, Sitecore refactored some services and configurations used by Next.js applications.
To upgrade JSS Next.js apps:
-
Follow the detailed upgrade guide for JSS Next.js apps.
Upgrade JSS Angular apps to JSS 21.6 and Angular 16
In JSS 21.6, the Angular template has been updated to use Angular 16.
-
Familiarize yourself with the JSS 21.6 release notes.
-
Read the Angular 16 release summary.
-
In the
package.jsonfile:-
Upgrade dependencies and development dependencies to Angular 16.
-
Upgrade the typescript package to version ~4.9.5.
-
To preserve the server artifacts path JSS conventions require, update your
build:serverandpostbuild:serverscripts. In thepackage.jsonfile, update the scripts to: -
To replace the deprecated
--deploy-urloption with--base-hrefng build option, update thebuild:clientscript to: -
Remove the
overridesworkaround.
-
-
In a shell, install/update dependencies in your app by running the following command:
-
In the
angular.jsonfile:-
Update the
allowedCommonJsDependenciesconfiguration. -
In the
server.optionsconfiguration, remove theoutputPathproperty and add theoutputHashingproperty with the valuenone. The finaloptionsneeds to contain the following:
-
-
In the
.eslintrcfile, replace the deprecated@angular-eslint/ng-cli-compatESLint rules with@angular-eslint/recommendedrules, as shown in this diff , and remove other outdated rules. -
In the
/src/app/app.module.ts, make the following changes:-
Remove the
BrowserModuleandTransferStateimport from the@angular/platform-browserpackage and add instead the following import statement: -
Remove the
NgModuleimport from the@angular/corepackage. -
In the
NgModuledecorator, in theimportsset, remove theBrowserModule.withServerTransition({ appId: 'my-app' })import. -
In the
NgModuledecorator, in theprovidersset, add the following:
-
-
Consult the Angular 15 to 16 upgrade guide for your Angular-specific upgrade needs and implement the changes in your application customization.