Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(h5): uncompiled es syntax #7522

Merged
merged 8 commits into from
Sep 23, 2020
Merged

fix(h5): uncompiled es syntax #7522

merged 8 commits into from
Sep 23, 2020

Conversation

huanz
Copy link
Contributor

@huanz huanz commented Sep 4, 2020

这个 PR 做了什么? (简要描述所做更改)

修复打包H5部分es语法未编译

这个 PR 是什么类型? (至少选择一个)

  • 错误修复(Bugfix) issue id #
  • 新功能(Feature)
  • 代码重构(Refactor)
  • TypeScript 类型定义修改(Typings)
  • 文档修改(Docs)
  • 代码风格更新(Code style update)
  • 其他,请描述(Other, please describe):

这个 PR 满足以下需求:

  • 提交到 master 分支
  • Commit 信息遵循 Angular Style Commit Message Conventions
  • 所有测试用例已经通过
  • 代码遵循相关包中的 .eslintrc, .tslintrc, .stylelintrc 所规定的规范
  • 在本地测试可用,不会影响到其它功能

这个 PR 涉及以下平台:

  • 微信小程序
  • 支付宝小程序
  • 百度小程序
  • 头条小程序
  • QQ 轻应用
  • 快应用平台(QuickApp)
  • Web 平台(H5)
  • 移动端(React-Native)

其它需要 Reviewer 或社区知晓的内容:

@huanz
Copy link
Contributor Author

huanz commented Sep 4, 2020

@Chen-jj

@Chen-jj
Copy link
Contributor

Chen-jj commented Sep 8, 2020

@huanz 老哥稍微讲解一下现有问题,和为什么这样做咯,没太明白

@huanz
Copy link
Contributor Author

huanz commented Sep 8, 2020

@Chen-jj 因为里面有一些 es 语法又没有编译,web 上低版本浏览器有问题

unfetch 是因为 unfetch 后缀是 mjs,没有被 babel-loader 处理到

@huanz
Copy link
Contributor Author

huanz commented Sep 10, 2020

@Chen-jj 看下呗?

@huanz
Copy link
Contributor Author

huanz commented Sep 16, 2020

@Chen-jj 这个下个版本能合下么

@ZakaryCode
Copy link
Contributor

fetch 没啥问题,但是还是不太能理解为啥改了几个var出来,是什么情况会在这些上面出现问题么?

@huanz
Copy link
Contributor Author

huanz commented Sep 18, 2020

改 var 的地方都是这些代码没有被编译的,不改编译出来的代码里面会有 let ,你可以看下h5编译后的代码

@ZakaryCode
Copy link
Contributor

改 var 的地方都是这些代码没有被编译的,不改编译出来的代码里面会有 let ,你可以看下h5编译后的代码

未能复现,这样在统一文件中混用var、let、const,实际上不太可能修复上述问题

@huanz
Copy link
Contributor Author

huanz commented Sep 22, 2020

@ZakaryCode 你看下H5打出来的包prod包,里面是不是有 let

@ZakaryCode
Copy link
Contributor

@ZakaryCode 你看下H5打出来的包prod包,里面是不是有 let

并没有

@huanz
Copy link
Contributor Author

huanz commented Sep 22, 2020

@ZakaryCode 在APP.js里面

image

@huanz
Copy link
Contributor Author

huanz commented Sep 22, 2020

@ZakaryCode __taroAppConfig 你可以直接搜这个

@huanz
Copy link
Contributor Author

huanz commented Sep 22, 2020

这只是其中一个地方的,其它几个地方 taroStyle 我在 webpack 里改掉了

@@ -327,17 +327,19 @@ export const getModule = (appPath: string, {
const styleLoader = getStyleLoader([defaultStyleLoaderOption, styleLoaderOption])
const topStyleLoader = getStyleLoader([defaultStyleLoaderOption, {
insert: function insertAtTop (element) {
const parent = document.querySelector('head')
// eslint-disable-next-line no-var
var parent = document.querySelector('head')
Copy link
Contributor

Choose a reason for hiding this comment

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

h5 文件的变更没有问题,但是这里的改动有些无缘由,不合理

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ZakaryCode 这里也需要改,这里的代码是源码插入进去的,一样存在未编译的 const ,你可以打包一下试试

@ZakaryCode ZakaryCode merged commit c3f34dc into NervJS:next Sep 23, 2020
@huanz
Copy link
Contributor Author

huanz commented Sep 23, 2020

@ZakaryCode 这里也需要改,这里的代码是源码插入进去的,一样存在未编译的 const ,你可以打包一下试试

ZakaryCode added a commit that referenced this pull request Sep 25, 2020
ZakaryCode added a commit that referenced this pull request Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V-3 Version - 3.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants