Skip to content
This repository was archived by the owner on Dec 6, 2021. It is now read-only.

Update package.json #37

Merged
merged 2 commits into from
Oct 19, 2020
Merged

Update package.json #37

merged 2 commits into from
Oct 19, 2020

Conversation

ljquan
Copy link

@ljquan ljquan commented Oct 15, 2020

在项目中使用,webpack会优先使用browser,即便是import也是用到了index.umd.js,导致AtAccordion组件点击抛错。
index.umd.js?aa1b:42 Uncaught (in promise) TypeError: Taro__default.default.createSelectorQuery is not a function
at delayQuerySelector (index.umd.js?aa1b:42)

在项目中使用,即便是import也是用到了index.umd.js,导致AtAccordion组件点击抛错
index.umd.js?aa1b:42 Uncaught (in promise) TypeError: Taro__default.default.createSelectorQuery is not a function
    at delayQuerySelector (index.umd.js?aa1b:42)
@b2nil b2nil self-requested a review October 15, 2020 03:55
@b2nil
Copy link
Owner

b2nil commented Oct 15, 2020

可以提供一个复现的 demo 吗?
我这边没法复现上面提到的这个 AtAccordion 组件点击抛错。

@ljquan
Copy link
Author

ljquan commented Oct 16, 2020

https://github.com/ljquan/taro-test
npm i
npm run dev:h5

@ljquan
Copy link
Author

ljquan commented Oct 16, 2020

image

@b2nil
Copy link
Owner

b2nil commented Oct 16, 2020

@ljquan
多谢耐心提供 repo。

我测试的时候,使用了之前的一个项目跑的,webpack config 里面把 taro-ui-vue3 alias 成了 taro-ui-vue3/dist/index.esm.js,所以没能发现问题。

看了 Taro 和 Taro UI 的相关 Issues: Taro UI #1178Taro #7300, 主要还是 Taro 方面的问题(已列入 milestone 3.0.11, 3.0.12).

新版本发布之前,可以临时在 webpack 配置中将 taro-ui-vue3 的 alias 设为 index.esm.js

关于这个 PR,如果只删除 package.json 里面的 browser 一项,会导致 rollup 打包时报错。

{
// rollup.config.js
      file: resolveFile(Package.browser), // <--
      format: 'umd',
      name: 'taro-ui-vue3',
      ...
}

@@ -2,7 +2,6 @@
"name": "taro-ui-vue3",
"version": "1.0.0-alpha.8",
"description": "Taro UI Rewritten in Vue 3.0",
"browser": "dist/index.umd.js",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rollup.config.js 引用了这里的路径,直接删除会导致 rollup 打包时报错。

@b2nil
Copy link
Owner

b2nil commented Oct 17, 2020

@ljquan
在 Taro 方面没解决这个问题之间,作为临时解决方案,这个 PR 很有必要。

可否新增一个 commit,保留 "browser" 入口,再新增一个 "main:h5" 入口,将其指向 "index.esm.js"。
这样既不用修改 rollup 配置,也能解决问题。

@b2nil b2nil reopened this Oct 17, 2020
@b2nil b2nil merged commit c0214e1 into b2nil:master Oct 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants