在高版本的taro中运行低版本的taro可能会存在兼容性问题,建议升级低版本的taro。

如果您确实需要在高版本taro中运行低版本taro,可以尝试以下步骤:

  1. 在项目根目录下安装低版本的taro:npm install taro@低版本号

  2. 修改项目的package.json文件,将taro的版本号修改为低版本号。

{
  "name": "myApp",
  "version": "1.0.0",
  "dependencies": {
    "taro": "低版本号"
  }
}
  1. 修改项目的配置文件taro.config.js,将编译器版本号修改为低版本号。例如,如果低版本号是1.2.0,则修改为:
module.exports = {
  // ...
  plugins: {
    // ...
    '@tarojs/plugin-terser': {
      enable: true,
      config: {
        // 将1.2.0修改为低版本号
        terserOptions: {
          compress: {
            drop_console: true,
            dead_code: true,
            warnings: false,
            pure_funcs: ['console.log']
          }
        }
      }
    }
  }
}
  1. 运行项目。使用低版本的taro编译器编译项目,并使用高版本的taro运行项目。
npm run dev:weapp // 使用高版本的taro运行项目
npm run build --taro // 使用低版本的taro编译器编译项目
``
高版本taro怎么运行低版本taro

原文地址: https://www.cveoy.top/t/topic/htmB 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录