Modern.js provides the upgrade
command to support upgrading the project to the latest version of Modern.js.
Run the upgrade
script in the project:
You can see that the dependencies in the project's package.json
have been updated to the latest version.
If the upgrade
command is not declared in the project's package.json
, you can execute npx modern upgrade
as an equivalent alternative.
All packages of Modern.js are currently released with a uniform version number.
According to the Release Note on the official website, developers can also manually upgrade the project to the desired version.
When upgrading, you need to upgrade all packages provided by Modern.js, rather than upgrading some dependencies.
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.
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.
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:
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:
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.