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
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/taro-h5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"jsonp-retry": "^1.0.3",
"mobile-detect": "^1.4.2",
"raf": "^3.4.1",
"unfetch": "^4.1.0",
"whatwg-fetch": "^2.0.4"
"whatwg-fetch": "^3.4.0"
}
}
2 changes: 1 addition & 1 deletion packages/taro-h5/src/api/request/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Taro from '@tarojs/api'
import 'unfetch/polyfill'
import 'whatwg-fetch'
import jsonpRetry from 'jsonp-retry'
import { serializeParams } from '../utils'
const { Link } = Taro
Expand Down
119 changes: 111 additions & 8 deletions packages/taro-h5/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,71 @@
# yarn lockfile v1


"@babel/runtime@^7.1.2":
version "7.11.2"
resolved "http://bnpm.byted.org/@babel/runtime/download/@babel/runtime-7.11.2.tgz#f549c13c754cc40b87644b9fa9f09a6a95fe0736"
integrity sha1-9UnBPHVMxAuHZEufqfCaapX+BzY=
dependencies:
regenerator-runtime "^0.13.4"

"@tarojs/api@3.0.8":
version "3.0.8"
resolved "http://bnpm.byted.org/@tarojs/api/download/@tarojs/api-3.0.8.tgz#45d74ebe32221e533ccc7edab22e5a491679af14"
integrity sha1-RddOvjIiHlM8zH7asi5aSRZ5rxQ=
dependencies:
"@tarojs/runtime" "3.0.8"

"@tarojs/router@3.0.8":
version "3.0.8"
resolved "http://bnpm.byted.org/@tarojs/router/download/@tarojs/router-3.0.8.tgz#65d52f6c4b77c03d45dedcd6d6fcd9ccb4c5d8cd"
integrity sha1-ZdUvbEt3wD1F3tzW1vzZzLTF2M0=
dependencies:
"@tarojs/runtime" "3.0.8"
history "^4.10.1"
universal-router "^8.3.0"
url-parse "^1.4.7"

"@tarojs/runtime@3.0.8":
version "3.0.8"
resolved "http://bnpm.byted.org/@tarojs/runtime/download/@tarojs/runtime-3.0.8.tgz#f21dddb09299ea57a0475e34ddc1ba995c910749"
integrity sha1-8h3dsJKZ6legR1403cG6mVyRB0k=

base64-js@^1.3.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1"
integrity sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==

history@^4.10.1:
version "4.10.1"
resolved "http://bnpm.byted.org/history/download/history-4.10.1.tgz#33371a65e3a83b267434e2b3f3b1b4c58aad4cf3"
integrity sha1-MzcaZeOoOyZ0NOKz87G0xYqtTPM=
dependencies:
"@babel/runtime" "^7.1.2"
loose-envify "^1.2.0"
resolve-pathname "^3.0.0"
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"
value-equal "^1.0.1"

"js-tokens@^3.0.0 || ^4.0.0":
version "4.0.0"
resolved "http://bnpm.byted.org/js-tokens/download/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
integrity sha1-GSA/tZmR35jjoocFDUZHzerzJJk=

jsonp-retry@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/jsonp-retry/-/jsonp-retry-1.0.3.tgz#9e6b18b02ec767a621dd44b4e99439a8a43a6419"
integrity sha512-/jmE9+shtKP+oIt2AWO9Wx+C27NTGpLCEw4QHOqpoV2X6ta374HE9C+EEdgu8r3iLKgFMx7u5j0mCwxWN8UdlA==
dependencies:
object-assign "^4.1.1"

loose-envify@^1.2.0:
version "1.4.0"
resolved "http://bnpm.byted.org/loose-envify/download/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
integrity sha1-ce5R+nvkyuwaY4OffmgtgTLTDK8=
dependencies:
js-tokens "^3.0.0 || ^4.0.0"

mobile-detect@^1.4.2:
version "1.4.4"
resolved "https://registry.yarnpkg.com/mobile-detect/-/mobile-detect-1.4.4.tgz#686c74e92d3cc06b09a9b3594b7b981494b137f6"
Expand All @@ -24,24 +77,74 @@ object-assign@^4.1.1:
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=

path-to-regexp@^3.1.0:
version "3.2.0"
resolved "http://bnpm.byted.org/path-to-regexp/download/path-to-regexp-3.2.0.tgz#fa7877ecbc495c601907562222453c43cc204a5f"
integrity sha1-+nh37LxJXGAZB1YiIkU8Q8wgSl8=

performance-now@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=

querystringify@^2.1.1:
version "2.2.0"
resolved "http://bnpm.byted.org/querystringify/download/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6"
integrity sha1-M0WUG0FTy50ILY7uTNogFqmu9/Y=

raf@^3.4.1:
version "3.4.1"
resolved "https://registry.yarnpkg.com/raf/-/raf-3.4.1.tgz#0742e99a4a6552f445d73e3ee0328af0ff1ede39"
integrity sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==
dependencies:
performance-now "^2.1.0"

unfetch@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/unfetch/-/unfetch-4.1.0.tgz#6ec2dd0de887e58a4dee83a050ded80ffc4137db"
integrity sha512-crP/n3eAPUJxZXM9T80/yv0YhkTEx2K1D3h7D1AJM6fzsWZrxdyRuLN0JH/dkZh1LNH8LxCnBzoPFCPbb2iGpg==
regenerator-runtime@^0.13.4:
version "0.13.7"
resolved "http://bnpm.byted.org/regenerator-runtime/download/regenerator-runtime-0.13.7.tgz#cac2dacc8a1ea675feaabaeb8ae833898ae46f55"
integrity sha1-ysLazIoepnX+qrrriugziYrkb1U=

requires-port@^1.0.0:
version "1.0.0"
resolved "http://bnpm.byted.org/requires-port/download/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=

resolve-pathname@^3.0.0:
version "3.0.0"
resolved "http://bnpm.byted.org/resolve-pathname/download/resolve-pathname-3.0.0.tgz#99d02224d3cf263689becbb393bc560313025dcd"
integrity sha1-mdAiJNPPJjaJvsuzk7xWAxMCXc0=

tiny-invariant@^1.0.2:
version "1.1.0"
resolved "http://bnpm.byted.org/tiny-invariant/download/tiny-invariant-1.1.0.tgz#634c5f8efdc27714b7f386c35e6760991d230875"
integrity sha1-Y0xfjv3CdxS384bDXmdgmR0jCHU=

tiny-warning@^1.0.0:
version "1.0.3"
resolved "http://bnpm.byted.org/tiny-warning/download/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754"
integrity sha1-lKMNtFPfTGQ9D9VmBg1gqHXYR1Q=

universal-router@^8.3.0:
version "8.3.0"
resolved "http://bnpm.byted.org/universal-router/download/universal-router-8.3.0.tgz#533bce135d7b1abf591421c5d2028d54407a34a0"
integrity sha1-UzvOE117Gr9ZFCHF0gKNVEB6NKA=
dependencies:
path-to-regexp "^3.1.0"

url-parse@^1.4.7:
version "1.4.7"
resolved "http://bnpm.byted.org/url-parse/download/url-parse-1.4.7.tgz#a8a83535e8c00a316e403a5db4ac1b9b853ae278"
integrity sha1-qKg1NejACjFuQDpdtKwbm4U64ng=
dependencies:
querystringify "^2.1.1"
requires-port "^1.0.0"

value-equal@^1.0.1:
version "1.0.1"
resolved "http://bnpm.byted.org/value-equal/download/value-equal-1.0.1.tgz#1e0b794c734c5c0cade179c437d356d931a34d6c"
integrity sha1-Hgt5THNMXAyt4XnEN9NW2TGjTWw=

whatwg-fetch@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f"
integrity sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng==
whatwg-fetch@^3.4.0:
version "3.4.0"
resolved "http://bnpm.byted.org/whatwg-fetch/download/whatwg-fetch-3.4.0.tgz#e11de14f4878f773fbebcde8871b2c0699af8b30"
integrity sha1-4R3hT0h493P7683ohxssBpmvizA=
2 changes: 1 addition & 1 deletion packages/taro-loader/src/h5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ window.__taroAppConfig = config
${config.tabBar ? tabBarCode : ''}
if (config.tabBar) {
var tabbarList = config.tabBar.list
for (let i = 0; i < tabbarList.length; i++) {
for (var i = 0; i < tabbarList.length; i++) {
var t = tabbarList[i]
if (t.iconPath) {
t.iconPath = tabbarIconPath[i]
Expand Down
8 changes: 5 additions & 3 deletions packages/taro-webpack-runner/src/util/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ,你可以打包一下试试

if (parent) {
const lastInsertedElement = (window as any)._lastElementInsertedByStyleLoader
// eslint-disable-next-line no-var
var lastInsertedElement = window._lastElementInsertedByStyleLoader
if (!lastInsertedElement) {
parent.insertBefore(element, parent.firstChild)
} else if (lastInsertedElement.nextSibling) {
parent.insertBefore(element, lastInsertedElement.nextSibling)
} else {
parent.appendChild(element)
}
(window as any)._lastElementInsertedByStyleLoader = element
window._lastElementInsertedByStyleLoader = element
}
}
}, styleLoaderOption])
Expand Down