index.umd.js?aa1b:42 Uncaught (in promise) TypeError: Taro__default.default.createSelectorQuery is not a function
at delayQuerySelector (index.umd.js?aa1b:42)
临时解决方案
在 taro-ui-vue3 或者 Taro 解决该问题前,请先使用以下临时解决方案:
在 webpack 配置中添加一条 alias 配置,将 taro-ui-vue3 入口指向 index.esm.js
问题描述
详情见 #37
该问题是因 @tarojs/taro-h5 下提供的 Api 接口 未能通过 babel-plugin-transform-taroapi 正确转译所致。
taro-ui-vue3
打包后提供三个格式的入口文件:taro-ui-vue3/dist/index.umd.js
taro-ui-vue3/dist/index.esm.js
taro-ui-vue3/dist/index.js
目前在
h5
环境中使用 CJS 和 UMD 格式的入口文件都存在上面的问题。因为 @tarojs/webpack-runner 编译的入口顺序是
mainFields: ['main:h5', 'browser', 'module', 'main']
, 所以优先引用了 UMD 入口。版本信息
v1.0.0-alpha.8
涉及的平台
h5
错误信息
临时解决方案
在
taro-ui-vue3
或者 Taro 解决该问题前,请先使用以下临时解决方案:taro-ui-vue3
入口指向index.esm.js
或者
node_modules/taro-ui-vue3/package.json
中添加"main:h5": index.esm.js