NervJS/taro

h5打包移除懒加载后打包报错

Opened this issue · 0 comments

相关平台

H5

浏览器版本: Chrome 131.0.6778.86
使用框架: React

复现步骤

根据文档https://taro-docs.jd.com/blog/2022-01-20-Taro-3.4#3-dynamic-import-node ,在taro项目中的babel.config.js增加如下配置后打包
presets: [
[
'taro',
{
framework: 'react',
ts: true,
hot: false,
'dynamic-import-node': true,
},
],
],

期望结果

h5正常移除懒加载打包不报错

实际结果

打包后报如下错
hook.js:608 Error: Cannot find module './taro-view-core.entry.js'
at webpackEmptyContext (eval at ./node_modules/@tarojs/components/dist/esm-es5 sync recursive (app.6bd2a42….js:4915:1), :2:10)
at eval (index-5bd7cbab.js:1482:1) undefined
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'isProxied')
at eval (index-5bd7cbab.js:1248:1)
at i (index-5bd7cbab.js:125:1)
at Object.eval [as next] (index-5bd7cbab.js:74:1)
at s (index-5bd7cbab.js:33:1)

环境信息

Taro CLI 3.4.4 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 16.15.1 - D:\tools\nodejs\node.EXE
      Yarn: 1.22.22 - D:\tools\nodejs\node_global\yarn.CMD
      npm: 8.11.0 - D:\tools\nodejs\npm.CMD