Closed ymq001 closed 1 year ago
taro 3.5.6 react框架下,通过 webpack5 构建小程序,首次运行正常,后续重复 build, 小程序将运行异常,类似问题提示 Template tmpl_0_custom-wrapper
not found。将 cache 设为 false,该场景并不出现,感觉启用缓存后,重复构建会丢失某些东西。
taro 3.5.6 react框架下,通过 webpack5 构建小程序,首次运行正常,后续重复 build, 小程序将运行异常,类似问题提示 Template
tmpl_0_custom-wrapper
not found。将 cache 设为 false,该场景并不出现,感觉启用缓存后,重复构建会丢失某些东西。
开了 cache 后,命中缓存时 Webpack 的一些 hooks 不会运行,如解析模块 AST 的 parse 相关钩子等。导致 Taro 一些编译逻辑没能正常运行,这块需要看看怎样配合 Webpack cache 把 Taro 对应逻辑进行缓存与恢复。
@Chen-jj 经解释,问题原因已了解,期待此问题的修复
@Chen-jj
需要解析 AST 来收集组件的第三方库,目前如果进行了 prebundle
,后面就收集不到组件了;关了 cache
也不行。
现在只能在 prebundle
配置中 exclude
需要收集组件的第三方库。二次编译时,每次都要重新编译一下。
prebundle
时能不能先解析一次指定模块(手动在配置中标记) 的 AST?
@Chen-jj 需要解析 AST 来收集组件的第三方库,目前如果进行了
prebundle
,后面就收集不到组件了;关了cache
也不行。 现在只能在prebundle
配置中exclude
需要收集组件的第三方库。二次编译时,每次都要重新编译一下。
prebundle
时能不能先解析一次指定模块(手动在配置中标记) 的 AST?
可以的,在 prebundle 的 webpack 编译阶段的 parse 钩子中进行同样的收集处理。但 prebundle 的 webpack 编译也开了 cache,所以 watch 时还会遇到问题。
我现在用的是 taro 3.5.6,nutui-taro 3.2.3,也会存在这种报错。使用dev:weapp会出现,但是build:weapp不会出现。这个是开发和最终编译哪里不同吗
同样的问题,dev:weapp
时必现,build:weapp
没问题。
@b2nil prebundle.exclude配置后可以解决,感谢!
但有副作用,Windows的小程序IDE自动编译失效了,每次都要手动点编译才能渲染最新的内容。
同样的问题,dev:weapp时必现,build:weapp没问题。
VM946:22 WXMLRT_$gwx:./base.wxml:template:477:16: Template `tmpl_0_31` not found.
_wp @ VM946:22
_w @ VM946:1024
d_.<computed>.tmpl_6_container @ VM946:5126
xC @ VM946:4736
wfor @ VM946:571
_2z @ VM946:714
d_.<computed>.tmpl_5_2 @ VM946:4744
d_.<computed>.tmpl_5_container @ VM946:4892
xC @ VM946:4467
wfor @ VM946:571
_2z @ VM946:714
d_.<computed>.tmpl_4_2 @ VM946:4475
d_.<computed>.tmpl_4_container @ VM946:4623
xC @ VM946:4114
wfor @ VM946:571
_2z @ VM946:714
d_.<computed>.tmpl_3_2 @ VM946:4122
d_.<computed>.tmpl_3_container @ VM946:4354
xC @ VM946:3761
wfor @ VM946:571
_2z @ VM946:714
d_.<computed>.tmpl_2_2 @ VM946:3769
d_.<computed>.tmpl_2_container @ VM946:4001
xC @ VM946:3408
wfor @ VM946:571
_2z @ VM946:714
d_.<computed>.tmpl_1_2 @ VM946:3416
d_.<computed>.tmpl_1_container @ VM946:3648
xC @ VM946:2802
wfor @ VM946:571
_2z @ VM946:714
d_.<computed>.tmpl_0_2 @ VM946:2810
d_.<computed>.tmpl_0_container @ VM946:3295
xC @ VM946:2684
wfor @ VM946:571
_2z @ VM946:714
d_.<computed>.taro_tmpl @ VM946:2692
m2 @ VM946:7070
(anonymous) @ VM946:7200
io @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
_updateValues @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
updateValues @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
u.doUpdates @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
y.setData @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ vendors-node_modules_taro_weapp_prebundle_chunk-E2COQYTW_js.js? [sm]:2960
f @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
p @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1
setTimeout (async)
globalThis.setTimeout @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
globalThis.setTimeout @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
performUpdate @ vendors-node_modules_taro_weapp_prebundle_chunk-E2COQYTW_js.js? [sm]:2891
(anonymous) @ vendors-node_modules_taro_weapp_prebundle_chunk-E2COQYTW_js.js? [sm]:855
wd @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:1098
$g @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:3665
Yg @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:3642
Xg @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:3623
Th @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:4424
Nh @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:4387
Eh @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:4050
J @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:119
R @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:151
f @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
p @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1
setTimeout (async)
globalThis.setTimeout @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
globalThis.setTimeout @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
S @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:168
I @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:174
exports.unstable_scheduleCallback @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:269
Dh @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:4821
Z @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:3965
Ad @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:3927
enqueueForceUpdate @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:1139
E.forceUpdate @ vendors-node_modules_taro_weapp_prebundle_chunk-LNJCN3VW_js.js? [sm]:58
mount @ vendors-node_modules_taro_weapp_prebundle_tarojs_plugin-framework-react_dist_runtime_js.js? [sm]:285
mount @ vendors-node_modules_taro_weapp_prebundle_tarojs_plugin-framework-react_dist_runtime_js.js? [sm]:325
mount @ vendors-node_modules_taro_weapp_prebundle_chunk-E2COQYTW_js.js? [sm]:848
(anonymous) @ vendors-node_modules_taro_weapp_prebundle_chunk-E2COQYTW_js.js? [sm]:862
(anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
u.__callPageLifeTime__ @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
xr @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1
l.emit @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1
emit @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1
l.emit @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1
emit @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1
(anonymous) @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1
emit @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1
c @ VM9 asdebug.js:10
u @ VM9 asdebug.js:10
(anonymous) @ VM9 asdebug.js:1
f @ VM9 asdebug.js:1
(anonymous) @ VM9 asdebug.js:1
t.setAppserviceReady @ VM9 asdebug.js:1
handleLoadDone @ VM9 asdebug.js:10
(anonymous) @ VM9 asdebug.js:10
setTimeout (async)
proxyAlert @ VM9 asdebug.js:10
doWhenAllScriptLoaded @ VM887:7351
(anonymous) @ VM887:15
loadBabelModules @ assubloader.js:1
async function (async)
loadBabelModules @ assubloader.js:1
window.loadBabelMod @ VM857:10
(anonymous) @ wrapNativeSuper.js:2
Show 67 more frames
[WXML Runtime warning] ./base.wxml
Template `tmpl_0_31` not found.
475 |
476 | <template name="tmpl_6_container">
> 477 | <template is="{{xs.a(6, i.nn, l)}}" data="{{i:i,cid:6,l:xs.f(l,i.nn)}}" />
| ^
478 | </template>
479 |
480 | <template name="tmpl_7_0">
同样的问题,
dev:weapp
时必现,build:weapp
没问题。 @b2nil prebundle.exclude配置后可以解决,感谢! 但有副作用,Windows的小程序IDE自动编译失效了,每次都要手动点编译才能渲染最新的内容。
prebundle.exclude 怎么配置的,我用了一个taro-ui的组件,前期是没问题的,下午突然发现不能使用了,
import { AtSwipeAction } from "taro-ui";
只要导入这个组件就报错 dev:weapp时必现,build:weapp没问题。
问题解决了
compiler: {
type: "webpack5",
prebundle: {
enable: false,
force: true,
},
},
同样的问题,dev:weapp时必现,build:weapp没问题。
VM946:22 WXMLRT_$gwx:./base.wxml:template:477:16: Template `tmpl_0_31` not found. _wp @ VM946:22 _w @ VM946:1024 d_.<computed>.tmpl_6_container @ VM946:5126 xC @ VM946:4736 wfor @ VM946:571 _2z @ VM946:714 d_.<computed>.tmpl_5_2 @ VM946:4744 d_.<computed>.tmpl_5_container @ VM946:4892 xC @ VM946:4467 wfor @ VM946:571 _2z @ VM946:714 d_.<computed>.tmpl_4_2 @ VM946:4475 d_.<computed>.tmpl_4_container @ VM946:4623 xC @ VM946:4114 wfor @ VM946:571 _2z @ VM946:714 d_.<computed>.tmpl_3_2 @ VM946:4122 d_.<computed>.tmpl_3_container @ VM946:4354 xC @ VM946:3761 wfor @ VM946:571 _2z @ VM946:714 d_.<computed>.tmpl_2_2 @ VM946:3769 d_.<computed>.tmpl_2_container @ VM946:4001 xC @ VM946:3408 wfor @ VM946:571 _2z @ VM946:714 d_.<computed>.tmpl_1_2 @ VM946:3416 d_.<computed>.tmpl_1_container @ VM946:3648 xC @ VM946:2802 wfor @ VM946:571 _2z @ VM946:714 d_.<computed>.tmpl_0_2 @ VM946:2810 d_.<computed>.tmpl_0_container @ VM946:3295 xC @ VM946:2684 wfor @ VM946:571 _2z @ VM946:714 d_.<computed>.taro_tmpl @ VM946:2692 m2 @ VM946:7070 (anonymous) @ VM946:7200 io @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 _updateValues @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 updateValues @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 u.doUpdates @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 y.setData @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ vendors-node_modules_taro_weapp_prebundle_chunk-E2COQYTW_js.js? [sm]:2960 f @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 p @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1 setTimeout (async) globalThis.setTimeout @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 globalThis.setTimeout @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 performUpdate @ vendors-node_modules_taro_weapp_prebundle_chunk-E2COQYTW_js.js? [sm]:2891 (anonymous) @ vendors-node_modules_taro_weapp_prebundle_chunk-E2COQYTW_js.js? [sm]:855 wd @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:1098 $g @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:3665 Yg @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:3642 Xg @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:3623 Th @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:4424 Nh @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:4387 Eh @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:4050 J @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:119 R @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:151 f @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 p @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1 setTimeout (async) globalThis.setTimeout @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 globalThis.setTimeout @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 S @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:168 I @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:174 exports.unstable_scheduleCallback @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:269 Dh @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:4821 Z @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:3965 Ad @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:3927 enqueueForceUpdate @ vendors-node_modules_taro_weapp_prebundle_react-dom_js.js? [sm]:1139 E.forceUpdate @ vendors-node_modules_taro_weapp_prebundle_chunk-LNJCN3VW_js.js? [sm]:58 mount @ vendors-node_modules_taro_weapp_prebundle_tarojs_plugin-framework-react_dist_runtime_js.js? [sm]:285 mount @ vendors-node_modules_taro_weapp_prebundle_tarojs_plugin-framework-react_dist_runtime_js.js? [sm]:325 mount @ vendors-node_modules_taro_weapp_prebundle_chunk-E2COQYTW_js.js? [sm]:848 (anonymous) @ vendors-node_modules_taro_weapp_prebundle_chunk-E2COQYTW_js.js? [sm]:862 (anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 u.__callPageLifeTime__ @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 xr @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WASubContext.js?t=wechat&s=1675063375877&v=2.29.1:1 l.emit @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1 emit @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1 l.emit @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1 emit @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1 (anonymous) @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1 emit @ WAServiceMainContext.js?t=wechat&s=1675063375877&v=2.29.1:1 c @ VM9 asdebug.js:10 u @ VM9 asdebug.js:10 (anonymous) @ VM9 asdebug.js:1 f @ VM9 asdebug.js:1 (anonymous) @ VM9 asdebug.js:1 t.setAppserviceReady @ VM9 asdebug.js:1 handleLoadDone @ VM9 asdebug.js:10 (anonymous) @ VM9 asdebug.js:10 setTimeout (async) proxyAlert @ VM9 asdebug.js:10 doWhenAllScriptLoaded @ VM887:7351 (anonymous) @ VM887:15 loadBabelModules @ assubloader.js:1 async function (async) loadBabelModules @ assubloader.js:1 window.loadBabelMod @ VM857:10 (anonymous) @ wrapNativeSuper.js:2 Show 67 more frames [WXML Runtime warning] ./base.wxml Template `tmpl_0_31` not found. 475 | 476 | <template name="tmpl_6_container"> > 477 | <template is="{{xs.a(6, i.nn, l)}}" data="{{i:i,cid:6,l:xs.f(l,i.nn)}}" /> | ^ 478 | </template> 479 | 480 | <template name="tmpl_7_0">
同样的问题,
dev:weapp
时必现,build:weapp
没问题。 @b2nil prebundle.exclude配置后可以解决,感谢! 但有副作用,Windows的小程序IDE自动编译失效了,每次都要手动点编译才能渲染最新的内容。prebundle.exclude 怎么配置的,我用了一个taro-ui的组件,前期是没问题的,下午突然发现不能使用了,
import { AtSwipeAction } from "taro-ui";
只要导入这个组件就报错 dev:weapp时必现,build:weapp没问题。
prebundle: { enable: false, force: true, },
感谢感谢,我也解决了,♥️
@tomnattle 感谢恩人
@tomnattle 感谢,我也是这个问题
我的taro 3.6.2 的 没成功
usingComponents: { contactCell: 'plugin://contactPlugin/cell', },
[WXML Runtime warning] ./base.wxml
Template `tmpl_0_contactcell` not found.
479 |
480 | <template name="tmpl_5_container">
> 481 | <template is="{{xs.a(5, i.nn, l)}}" data="{{i:i,cid:5,l:xs.f(l,i.nn)}}" />
| ^
482 | </template>
483 |
484 | <template name="tmpl_6_0">
@gooddaddy 用前面的这个:
prebundle: {
enable: false,
force: true,
},
@nevernet
在V3.6.2中 使用小程序的客服插件的时候会报错的,使用了上面的配置也不行。降到3.5.*的版本就可以
有什么解决方案吗,配置后没生效
dev.js
prebundle: {
enable: false,
force: true,
}
{
"@nutui/nutui-react": "^1.5.7"
}
试试prebundle.exclude
,
...,
compiler: {
...,
prebundle: {
...,
exclude: ['taro-ui'], // 'taro-ui' 可以替换成其他你需要排除的库
},
},
试试
prebundle.exclude
,..., compiler: { ..., prebundle: { ..., exclude: ['taro-ui'], // 'taro-ui' 可以替换成其他你需要排除的库 }, },
测试后没有效果
compiler: {
type: 'webpack5',
prebundle: {
enable: false,
force: true,
exclude: ['nutui/nutui-react']
}
},
测试后没有效果
compiler: { type: 'webpack5', prebundle: { enable: false, force: true, exclude: ['nutui/nutui-react'] } },
@mdddj 如果要排除@nutui/nutui-react
,包名应该是@nutui/nutui-react
,不是nutui/nutui-react
。😄
如果要排除
@nutui/nutui-react
,包名应该是@nutui/nutui-react
,不是nutui/nutui-react
。😄
多谢大佬回复,我已经用nutui 的模板新建项目解决了🙏
啊
我们在taro使用原生组件时遇到这个问题。
Taro v3.6.9 后,修复了开启 webpack5 cache 后,二次编译报错找不到模板的问题。相关 PR:https://github.com/NervJS/taro/pull/14117
我用 taroui 也出现该问题, 使用
// compiler: 'webpack5',
compiler: {
type: 'webpack5',
prebundle: {
enable: false,
force: true,
},
},
解决
已确认该问题在 3.6.18 依然存在
关闭 prebundle
,关闭 cache
,手动删除 node_mdoules/.cache
/ node_mdoules/.taro
,均无法解决
已确认该问题在 3.6.18 依然存在
关闭
prebundle
,关闭cache
,手动删除node_mdoules/.cache
/node_mdoules/.taro
,均无法解决
我的解决了,是在dev.ts中写的吗 @Airkro
我的3.6.23加taro-ui-3.3.0 也有问题,过年还好好的,坐个飞机代码被辐射了? 改成这样也不行
cache: {
enable: false, // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
},
prebundle: {
enable: false,
force: true,
exclude: ['taro-ui'], // 'taro-ui' 可以替换成其他你需要排除的库
},
3.6.26版本依然无效 compiler: { type: 'webpack5', prebundle: { enable: false, force: true } }, cache: { enable: true }
第一次打包还是会报模板找不到
这个其实是开启了 webpack5 的 prebundle ,只要引入了 @taro/components 的 Button 组件的页面都会报这个警告,有时候热更新几次后警告又没有了,会不会是 Button 组件开发的问题
可以试试删除这个目录[项目路径]/node_modules/.taro
,然后再启动构建
今天碰到同样的问题。lock 删了重装以后好了
@gooddaddy 用前面的这个:
prebundle: { enable: false, force: true, },
It works for me!
相关平台
微信小程序
复现仓库
https://github.com/ymq001/taro-bug-repo 小程序基础库: 2.26.0 使用框架: React
复现步骤
运行 dev:weapp 在 page/index/index.tsx 中使用 AtButton 组件
报错:
期望结果
运行 dev:weapp 命令时,不会出现报错,且组件无法正常使用的情况
实际结果
运行 dev:weapp 命令时,出现报错,且组件无法正常使用
环境信息