taro icon indicating copy to clipboard operation
taro copied to clipboard

[Bug]: 原生项目使用 Taro,无法运行

Open feacx opened this issue 7 months ago • 0 comments

相关平台

微信小程序

小程序基础库版本

3.8.3

使用框架

React

问题描述

使用 Taro 3.6.x 通过下方命令编译后可以置入原生小程序中正常运行,此时使用的是 webpacktaro build --type weapp --new-blended plugins: ['@tarojs/plugin-indie'],

但是目前使用的是 4.x,使用 taro init 生成,默认使用 Vite 编译,无法使用 plugins: ['@tarojs/plugin-indie'],,因为这个插件是基于 webpack 的。

不用这个插件放入小程序后提示

TypeError: Cannot read property 'mount' of null at a (taro.js? [sm]:1) at li. (taro.js? [sm]:1) at li.e. (vendor.js:6049) at li.options. [as onLoad] (vendor.js:866) at li. (WASubContext.js?t=wechat&s=1747189815314&v=3.8.3:1) at li.c.callPageLifeTime (WASubContext.js?t=wechat&s=1747189815314&v=3.8.3:1) at WASubContext.js?t=wechat&s=1747189815314&v=3.8.3:1 at WASubContext.js?t=wechat&s=1747189815314&v=3.8.3:1 at WASubContext.js?t=wechat&s=1747189815314&v=3.8.3:1 at WASubContext.js?t=wechat&s=1747189815314&v=3.8.3:1(env: macOS,mp,1.06.2402021; lib: 3.8.3)

复现链接

null

复现步骤

No response

环境信息

node 20.5.0

feacx avatar May 14 '25 02:05 feacx