Ensuring Backward Compatibility with SDK 22 and Chromium 60 #4

Closed
yl12053 wants to merge 0 commits from master into master
yl12053 commented 2024-12-20 04:21:16 +00:00 (Migrated from gitgud.io)

This merge request attempts to lower sdkVersion to:

  • minSdkVersion 22 (Android 5.1)
  • compileSdkVersion 34 (Android 14)
  • targetSdkVersion 34

It also polyfills missing JavaScript functions using core-js and compiles ECMAScript6 syntax to ECMAScript5, including:

  • Nullish coalescing operator
  • Optional chaining
  • Logical AND/OR assignment

However, due to the outdated WebView bundled with Android 5.1 (Chromium 39.0.0) which doesn't support features like dynamic import, ESM Bundles are currently unavailable with this solution. Users on Android 5.1 must either update their system WebView, developers must bundle a Chromium instance in the app, or compile JavaScript from ESM to SystemJS (or CommonJS) using Babel, and use <script nomodule/> for such WebView.

Note: The usage of Babel is rather rough, as it waits for the entire Vits bundle before transpiling the bundled code to remove new syntax. This may result in a loss of efficiency and disk space. Unfortunately, I couldn't figure out how to integrate Babel with Vits correctly to call Babel after bundle completion but not before, as the bundle process might introduce new syntax.

This merge request attempts to lower sdkVersion to: - minSdkVersion 22 (Android 5.1) - compileSdkVersion 34 (Android 14) - targetSdkVersion 34 It also polyfills missing JavaScript functions using core-js and compiles ECMAScript6 syntax to ECMAScript5, including: - Nullish coalescing operator - Optional chaining - Logical AND/OR assignment However, due to the outdated WebView bundled with Android 5.1 (Chromium 39.0.0) which doesn't support features like dynamic import, ESM Bundles are currently unavailable with this solution. Users on Android 5.1 must either update their system WebView, developers must bundle a Chromium instance in the app, or compile JavaScript from ESM to SystemJS (or CommonJS) using Babel, and use `<script nomodule/>` for such WebView. **Note:** The usage of Babel is rather rough, as it waits for the entire Vits bundle before transpiling the bundled code to remove new syntax. This may result in a loss of efficiency and disk space. Unfortunately, I couldn't figure out how to integrate Babel with Vits correctly to call Babel after bundle completion but not before, as the bundle process might introduce new syntax.
SLeader commented 2024-12-20 04:57:49 +00:00 (Migrated from gitgud.io)

感觉里面有一大堆生成的文件,麻烦把最终结果之外的生成文件都删掉

另外babel看看能不能配置到vite里面

感觉里面有一大堆生成的文件,麻烦把最终结果之外的生成文件都删掉 另外babel看看能不能配置到vite里面
SLeader commented 2024-12-20 04:57:57 +00:00 (Migrated from gitgud.io)

assigned to @SLeader

assigned to @SLeader
SLeader commented 2024-12-20 04:58:07 +00:00 (Migrated from gitgud.io)

assigned to @yl12053 and unassigned @SLeader

assigned to @yl12053 and unassigned @SLeader
SLeader commented 2024-12-20 04:58:14 +00:00 (Migrated from gitgud.io)

requested review from @SLeader

requested review from @SLeader
yl12053 commented 2024-12-20 08:29:12 +00:00 (Migrated from gitgud.io)

你说的那堆生成的文件该不会是指的pwa-elements吧
这堆文件确实是ionic的 本来是index.html在CDN上面直接引用的

src/index.html 
@@ -10,12 +10,12 @@
  <meta content="telephone=no" name="format-detection" />
  <meta content="no" name="msapplication-tap-highlight" />
  <script
-    src="https://unpkg.com/@ionic/pwa-elements@latest/dist/ionicpwaelements/ionicpwaelements.esm.js"
+    src="/js/pwa-elements/ionicpwaelements/ionicpwaelements.esm.js"
    type="module"
  ></script>
  <script
    nomodule
-    src="https://unpkg.com/@ionic/pwa-elements@latest/dist/ionicpwaelements/ionicpwaelements.js"
+    src="/js/pwa-elements/ionicpwaelements/ionicpwaelements.js"
  ></script>

因为如果要爬CDN的话会导致没网或者CDN掉了都没办法正常运作我就直接整个Esm下下来了

另外配置babel到vite里面...正如Overview的最后一段写的
我是死活配置不进去 无论怎么配babel都是在Bundle之前transpile
然后一bundle新语法又出来了(

你说的那堆生成的文件该不会是指的pwa-elements吧 这堆文件确实是ionic的 本来是index.html在CDN上面直接引用的 ```diff src/index.html @@ -10,12 +10,12 @@ <meta content="telephone=no" name="format-detection" /> <meta content="no" name="msapplication-tap-highlight" /> <script - src="https://unpkg.com/@ionic/pwa-elements@latest/dist/ionicpwaelements/ionicpwaelements.esm.js" + src="/js/pwa-elements/ionicpwaelements/ionicpwaelements.esm.js" type="module" ></script> <script nomodule - src="https://unpkg.com/@ionic/pwa-elements@latest/dist/ionicpwaelements/ionicpwaelements.js" + src="/js/pwa-elements/ionicpwaelements/ionicpwaelements.js" ></script> ``` 因为如果要爬CDN的话会导致没网或者CDN掉了都没办法正常运作我就直接整个Esm下下来了 另外配置babel到vite里面...正如Overview的最后一段写的 我是死活配置不进去 无论怎么配babel都是在Bundle之前transpile 然后一bundle新语法又出来了(
yl12053 commented 2024-12-20 08:35:03 +00:00 (Migrated from gitgud.io)

P.P.S. 就算不能把pwa-elements直接存进本地也好,我觉得最好还是写一下第一次从网络获取之后都从本地读的方案

P.P.S. 就算不能把`pwa-elements`直接存进本地也好,我觉得最好还是写一下第一次从网络获取之后都从本地读的方案
SLeader commented 2024-12-20 08:40:47 +00:00 (Migrated from gitgud.io)

pwa-elements如果都是需要的话那就这样吧

babel还是配一下吧,现在这种写法太丑了

pwa-elements如果都是需要的话那就这样吧 babel还是配一下吧,现在这种写法太丑了
yl12053 commented 2024-12-20 10:08:54 +00:00 (Migrated from gitgud.io)

added 3 commits

  • f3e98393 - Feature removal: remove babel from CLI
  • 2eeb64f5 - Bundled babel with Vits; PWA-Elements transpiled
  • 7b2ec4c6 - Implemented Exit

Compare with previous version

added 3 commits <ul><li>f3e98393 - Feature removal: remove babel from CLI</li><li>2eeb64f5 - Bundled babel with Vits; PWA-Elements transpiled</li><li>7b2ec4c6 - Implemented Exit</li></ul> [Compare with previous version](/umaera/ere-app/-/merge_requests/1/diffs?diff_id=351601&start_sha=ad721d976422bdd2ae6ce8bf3ca9946d8f34c884)
yl12053 commented 2024-12-20 10:09:24 +00:00 (Migrated from gitgud.io)

added 7 commits

  • 7b2ec4c6...5c05c2b9 - 6 commits from branch umaera:master
  • 838ca3c4 - Merge branch ere-app:master into master

Compare with previous version

added 7 commits <ul><li>7b2ec4c6...5c05c2b9 - 6 commits from branch <code>umaera:master</code></li><li>838ca3c4 - Merge branch ere-app:master into master</li></ul> [Compare with previous version](/umaera/ere-app/-/merge_requests/1/diffs?diff_id=351603&start_sha=7b2ec4c69d1652086507d81240448e2ca6fbfbac)
yl12053 commented 2024-12-20 10:23:44 +00:00 (Migrated from gitgud.io)

added 1 commit

  • 46682747 - Update engine.js

Compare with previous version

added 1 commit <ul><li>46682747 - Update engine.js</li></ul> [Compare with previous version](/umaera/ere-app/-/merge_requests/1/diffs?diff_id=351605&start_sha=838ca3c41d4b92c0176b0171597ad2fef676f994)
yl12053 commented 2024-12-20 10:25:13 +00:00 (Migrated from gitgud.io)

added 1 commit

  • 2803a61e - Update .gitignore

Compare with previous version

added 1 commit <ul><li>2803a61e - Update .gitignore</li></ul> [Compare with previous version](/umaera/ere-app/-/merge_requests/1/diffs?diff_id=351607&start_sha=466827472fda780631a2fdf7f3d87871d755a0fd)
yl12053 commented 2024-12-20 10:40:17 +00:00 (Migrated from gitgud.io)

btw, the process still cannot be rendered on Chromium 39 with unknown reason (where Console does not have any output)
Debugging is still in its way

btw, the process still cannot be rendered on Chromium 39 with unknown reason (where Console does not have any output) Debugging is still in its way
yl12053 (Migrated from gitgud.io) closed this pull request 2024-12-20 10:51:48 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
UmaERA/ere-app!4
No description provided.