taro 2.2.11与原生小程序混合开发 使用addChunkPages 打包后分包页面空白



  • 相关平台
    微信小程序

    小程序基础库: 2.15.0
    使用框架: React

    复现步骤
    taro与原生小程序混合开发,在packageC里写入原生小程序的页面,在config/index中配置wepackchain和addChunkPages, 抽离出C包里的公共文件,执行np run dev:weapp后小程序能正常打开 但是进入分包页面页面空白,控制台查看wxml没有加载出来,且没有任何报错信息

    mini: {
    webpackChain(chain, webpack) {
    chain.merge({
    optimization: {
    splitChunks: {
    cacheGroups: {
    "packageC/subCommon":{
    name: "packageC/subCommon",
    priority: 1000,
    test(module) {
    if (
    /src[\/]packageC[\/]utils/.test(module.resource)
    ) {
    return true;
    }
    },
    },
    }
    }
    }
    })
    })
    }

    addChunkPages(pages, pagesNames) {
    pages.set("packageC/pages/edit_post/edit_post", ["packageC/subCommon"]);
    },

    环境信息
    👽 Taro v2.2.11

    Taro CLI 2.2.11 environment info:
    System:
    OS: macOS 10.14
    Shell: 3.2.57 - /bin/bash
    Binaries:
    Node: 12.3.1 - /usr/local/bin/node
    npm: 6.14.10 - /usr/local/bin/npm
    npmPackages:
    @tarojs/cli: 2.2.11 => 2.2.11
    @tarojs/components: 2.2.11 => 2.2.11
    @tarojs/mini-runner: 2.2.11 => 2.2.11
    @tarojs/plugin-babel: 2.2.11 => 2.2.11
    @tarojs/plugin-csso: 2.2.11 => 2.2.11
    @tarojs/plugin-sass: 2.2.11 => 2.2.11
    @tarojs/plugin-uglify: ^2.2.7 => 2.2.10
    @tarojs/redux: 2.2.11 => 2.2.11
    @tarojs/redux-h5: 2.2.11 => 2.2.11
    @tarojs/router: 2.2.11 => 2.2.11
    @tarojs/taro: 2.2.11 => 2.2.11
    @tarojs/taro-alipay: 2.2.11 => 2.2.11
    @tarojs/taro-h5: 2.2.11 => 2.2.11
    @tarojs/taro-swan: 2.2.11 => 2.2.11
    @tarojs/taro-tt: 2.2.11 => 2.2.11
    @tarojs/taro-weapp: 2.2.11 => 2.2.11
    @tarojs/webpack-runner: 2.2.11 => 2.2.11
    eslint-config-taro: 2.2.11 => 2.2.11
    eslint-plugin-taro: 2.2.11 => 2.2.11
    nerv-devtools: ^1.5.7 => 1.5.7
    nervjs: ^1.5.7 => 1.5.7
    taro-ui: ^2.2.1 => 2.3.4


登录后回复