-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Conversation
@huanz 老哥稍微讲解一下现有问题,和为什么这样做咯,没太明白 |
@Chen-jj 因为里面有一些 es 语法又没有编译,web 上低版本浏览器有问题 unfetch 是因为 unfetch 后缀是 mjs,没有被 babel-loader 处理到 |
@Chen-jj 看下呗? |
@Chen-jj 这个下个版本能合下么 |
fetch 没啥问题,但是还是不太能理解为啥改了几个var出来,是什么情况会在这些上面出现问题么? |
改 var 的地方都是这些代码没有被编译的,不改编译出来的代码里面会有 let ,你可以看下h5编译后的代码 |
未能复现,这样在统一文件中混用var、let、const,实际上不太可能修复上述问题 |
@ZakaryCode 你看下H5打出来的包prod包,里面是不是有 let |
并没有 |
@ZakaryCode 在APP.js里面 |
@ZakaryCode __taroAppConfig 你可以直接搜这个 |
这只是其中一个地方的,其它几个地方 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') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
h5 文件的变更没有问题,但是这里的改动有些无缘由,不合理
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ZakaryCode 这里也需要改,这里的代码是源码插入进去的,一样存在未编译的 const ,你可以打包一下试试
@ZakaryCode 这里也需要改,这里的代码是源码插入进去的,一样存在未编译的 const ,你可以打包一下试试 |
这个 PR 做了什么? (简要描述所做更改)
修复打包H5部分es语法未编译
这个 PR 是什么类型? (至少选择一个)
这个 PR 满足以下需求:
这个 PR 涉及以下平台:
其它需要 Reviewer 或社区知晓的内容: