从 Ionic 4 更新到 5
¥Updating from Ionic 4 to 5
将应用从 Ionic 4 迁移到 5 需要对 API 属性、CSS 实用程序和已安装的包依赖进行一些更新。
¥Migrating an app from Ionic 4 to 5 requires a few updates to the API properties, CSS utilities, and the installed package dependencies.
本指南假设你已将应用更新到最新版本的 Ionic 4。在开始本指南之前,请确保你已遵循 更新到 Ionic 4 指南。
¥This guide assumes that you have already updated your app to the latest version of Ionic 4. Make sure you have followed the Updating to Ionic 4 Guide before starting this guide.
有关从 Ionic 4 到 Ionic 5 的重大更改的完整列表,请参阅 Ionic 框架存储库中的 重大变更文档。
¥For a complete list of breaking changes from Ionic 4 to Ionic 5, please refer to the breaking changes document in the Ionic Framework repository.
包和依赖
¥Packages and Dependencies
对于基于 Angular 的项目,你只需运行:
¥For Angular based projects, you can simply run:
npm install @ionic/angular@v5-lts @ionic/angular-toolkit@4.0.0 --save
对于 React 项目,你可以运行:
¥For React projects, you can run:
npm install @ionic/react@v5-lts @ionic/react-router@v5-lts ionicons@5.5.3
对于 Stencil / vanilla JS 项目,你可以运行:
¥For Stencil / vanilla JS projects, you can run:
npm i @ionic/core@v5-lts --save
如果你想要一个新的项目启动器,可以从 CLI 创建新的项目库,并可以手动迁移现有应用。
¥If you would like a fresh project starter, a new project base can be created from the CLI and an existing app can be migrated over manually.