Upgrading
Manual Upgrade
All Modern.js official packages are released with a uniform version number, so when upgrading, you need to update all @modern-js/** packages to the target version uniformly.
Upgrade Steps
-
Check the latest version
You can check the latest version of Modern.js through the following methods:
- Visit npm to check the latest version of
@modern-js/app-tools - Check GitHub Releases
According to the Release Note on the official website, developers can also manually upgrade the project to the desired version.
- Visit npm to check the latest version of
-
Update package.json
In the project's
package.json, update all@modern-js/**packages to the target version. For example:package.json -
Reinstall dependencies
After updating
package.json, reinstall dependencies:
When upgrading, you need to upgrade all packages provided by Modern.js uniformly, rather than upgrading individual dependencies. Ensure that all @modern-js/** packages have the same version number.
Version Management Strategy
In Modern.js projects, we recommend that all officially provided dependencies use fixed version, and avoid using ^ or ~ for range declarations. For example:
This ensures that the versions of dependencies are fully determined, thereby guaranteeing build consistency and predictability.
Lock nested dependency
When a nested dependency of the project has a problem and Modern.js cannot be updated immediately, you can use the package manager to lock the version of the nested dependency.
pnpm
For projects using pnpm, add the following configuration to the package.json in the root directory of the project, and then run pnpm install again:
Yarn
For projects using Yarn, add the following configuration to the package.json in the root directory of the project, and then run yarn install again:
Npm
For projects using Npm, add the following configuration to the package.json in the root directory of the project, and then run npm install again:
For Monorepo repositories, you can only lock dependency versions in the package.json in the root directory of the project, and it will affect all packages in the Monorepo.