taro icon indicating copy to clipboard operation
taro copied to clipboard

Taro 3.6.8 不支持 NutUI 2.0.0-alpha.16

Open Kennytian opened this issue 1 year ago • 14 comments

相关平台

微信小程序

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

复现步骤

taro init 初始化项目,选择 NutUI, 升级NutUI 为 @nutui/nutui-react-taro": "^2.0.0-alpha.16", pnpm run weapp:dev,控制台报错

期望结果

正常运行

实际结果

VM1029:9 app.js错误:
 Error: module 'prebundle/vendors-node_modules_taro_weapp_prebundle_nutui_nutui-react-taro_js.wxss.js' is not defined, require args is './prebundle/vendors-node_modules_taro_weapp_prebundle_nutui_nutui-react-taro_js.wxss'
    at q (WASubContext.js?t=wechat&s=1686526940612&v=2.32.2:1)
    at n (WASubContext.js?t=wechat&s=1686526940612&v=2.32.2:1)
    at app.js:6
    at WASubContext.js?t=wechat&s=1686526940612&v=2.32.2:1
    at f.runWith (WASubContext.js?t=wechat&s=1686526940612&v=2.32.2:1)
    at q (WASubContext.js?t=wechat&s=1686526940612&v=2.32.2:1)
    at <anonymous>:7:9
    at doWhenAllScriptLoaded (<anonymous>:6777:21)
    at Object.scriptLoaded (<anonymous>:6805:5)
    at Object.<anonymous> (<anonymous>:6830:22)(env: macOS,mp,1.06.2306020; lib: 2.32.2)
(anonymous) @ VM1029:9
doWhenAllScriptLoaded @ VM1008:6777
scriptLoaded @ VM1008:6805
(anonymous) @ VM1008:6830
Promise.then (async)
(anonymous) @ VM1008:6851
(anonymous) @ VM1008:6855
loadScripts @ assubloader.js:1
async function (async)
loadScripts @ assubloader.js:1
loadAppResourceScripts @ assubloader.js:1
(anonymous) @ app-service.js:1
WAServiceMainContext.js?t=wechat&s=1686526940612&v=2.32.2:1 Error: module 'prebundle/vendors-node_modules_taro_weapp_prebundle_nutui_nutui-react-taro_js.wxss.js' is not defined, require args is './prebundle/vendors-node_modules_taro_weapp_prebundle_nutui_nutui-react-taro_js.wxss'
    at q (WASubContext.js?t=wechat&s=1686526940612&v=2.32.2:1)
    at n (WASubContext.js?t=wechat&s=1686526940612&v=2.32.2:1)
    at app.js:6
    at WASubContext.js?t=wechat&s=1686526940612&v=2.32.2:1
    at f.runWith (WASubContext.js?t=wechat&s=1686526940612&v=2.32.2:1)
    at q (WASubContext.js?t=wechat&s=1686526940612&v=2.32.2:1)
    at <anonymous>:7:9
    at doWhenAllScriptLoaded (<anonymous>:6777:21)
    at Object.scriptLoaded (<anonymous>:6805:5)
    at Object.<anonymous> (<anonymous>:6830:22)(env: macOS,mp,1.06.2306020; lib: 2.32.2)

image

环境信息

 Taro CLI 3.6.8 environment info:
    System:
      OS: macOS 13.4
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
      Yarn: 1.22.19 - ~/.nvm/versions/node/v18.16.0/bin/yarn
      npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.8 => 3.6.8 
      @tarojs/components: 3.6.8 => 3.6.8 
      @tarojs/helper: 3.6.8 => 3.6.8 
      @tarojs/plugin-framework-react: 3.6.8 => 3.6.8 
      @tarojs/plugin-html: 3.6.8 => 3.6.8 
      @tarojs/plugin-platform-alipay: 3.6.8 => 3.6.8 
      @tarojs/plugin-platform-h5: 3.6.8 => 3.6.8 
      @tarojs/plugin-platform-jd: 3.6.8 => 3.6.8 
      @tarojs/plugin-platform-qq: 3.6.8 => 3.6.8 
      @tarojs/plugin-platform-swan: 3.6.8 => 3.6.8 
      @tarojs/plugin-platform-tt: 3.6.8 => 3.6.8 
      @tarojs/plugin-platform-weapp: 3.6.8 => 3.6.8 
      @tarojs/react: 3.6.8 => 3.6.8 
      @tarojs/runtime: 3.6.8 => 3.6.8 
      @tarojs/shared: 3.6.8 => 3.6.8 
      @tarojs/taro: 3.6.8 => 3.6.8 
      @tarojs/taro-loader: 3.6.8 => 3.6.8 
      @tarojs/webpack5-runner: 3.6.8 => 3.6.8 
      babel-preset-taro: 3.6.8 => 3.6.8 
      eslint-config-taro: 3.6.8 => 3.6.8 
      react: ^18.0.0 => 18.2.0 

Kennytian avatar Jun 12 '23 00:06 Kennytian

Taro 3.6.7 支持 NutUI 2.0.0-alpha.16 没有问题,请大家帮忙看看。

Kennytian avatar Jun 12 '23 00:06 Kennytian

把预编译关了先

bigmeow avatar Jun 12 '23 02:06 bigmeow

把预编译关了先

@bigmeow 谢谢回复。

config/index.js 部分代码

  framework: 'react',
  // compiler: 'webpack5',
  compiler: {
    prebundle: { enable: false },
  },

报错代码:

node:internal/errors:490
    ErrorCaptureStackTrace(err);
    ^

TypeError: The "id" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:399:5)
    at validateString (node:internal/validators:163:11)
    at Module.require (node:internal/modules/cjs/loader:1134:3)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/Users/demo/node_modules/.pnpm/@[email protected]/node_modules/@tarojs/helper/src/npm.ts:164:17)
    at Generator.next (<anonymous>)
    at /Users/demo/node_modules/.pnpm/@[email protected]/node_modules/@tarojs/helper/dist/npm.js:31:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/demo/node_modules/.pnpm/@[email protected]/node_modules/@tarojs/helper/dist/npm.js:27:12)
    at Object.getNpmPkg (/Users/demo/node_modules/.pnpm/@[email protected]/node_modules/@tarojs/helper/dist/npm.js:174:12) {
  code: 'ERR_INVALID_ARG_TYPE'
}

image

Kennytian avatar Jun 12 '23 03:06 Kennytian

@bigmeow demo repo: https://github.com/Kennytian/taro-latest-demo

Kennytian avatar Jun 12 '23 03:06 Kennytian

可能和这里之类有关, @luckyadam

bigmeow avatar Jun 12 '23 06:06 bigmeow

+1, 升级到3.6.8, 编译选项就开始报错了

  compiler: {
    type: 'webpack5',
    prebundle: {
      enable: false,
    },
  },

退回到3.6.7可以正常编译

bingtsingw avatar Jun 12 '23 10:06 bingtsingw

+1, 升级到3.6.8, 编译选项就开始报错了

  compiler: {
    type: 'webpack5',
    prebundle: {
      enable: false,
    },
  },

退回到3.6.7可以正常编译

你跟他不是一个问题 NervJS/taro-doctor#5

TheKonka avatar Jun 12 '23 10:06 TheKonka

这个问题还没有解决。 如果 设置这个 compiler: { type: 'webpack5', prebundle: { enable: false, }, },

那么h5 又不正常

zhoulujun avatar Jul 30 '23 15:07 zhoulujun

`compiler: {

type: 'webpack5',

// * 预编译,关闭后dev:h5报错, 开启后dev: weapp报错
prebundle: {
  enable: process.env.TARO_ENV === 'h5',
}

},` 好无奈啊

Max0897 avatar Aug 10 '23 03:08 Max0897

什么时候可以解决?

mamba-1024 avatar Aug 17 '23 15:08 mamba-1024

请问 taro 3.6.14 怎么解决这个问题

cat-kun avatar Aug 25 '23 10:08 cat-kun

巧了,taro 3.6.23 和 nutui 4.2.9也有这个问题哦

mindfocus avatar Jan 30 '24 14:01 mindfocus

	compiler: {
		type: 'webpack5',
		prebundle: {
			enable: false
		}
	},

关闭 prebundle 看看

TheKonka avatar Feb 01 '24 01:02 TheKonka

敲一下这个问题解决了吗 ? 关闭 prebundle 确实可以,但是官方的介绍 prebundle 提速的 🌰 就是拿 nutui 举的 …… 是不是有点搞笑了

wlw620 avatar Apr 12 '24 07:04 wlw620