Last active
November 11, 2024 16:56
Revisions
-
xuxucode revised this gist
Aug 24, 2023 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,6 +7,8 @@ 参考文档:https://github.com/zloirock/core-js/tree/master/packages/core-js-builder ```js import builder from 'core-js-builder' await builder({ // 所有需要的模块('core-js/actual/url' 包含 URL 和 URLSearchParams:https://github.com/zloirock/core-js#url-and-urlsearchparams) modules: ['core-js/actual/url'], -
xuxucode renamed this gist
Aug 21, 2023 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
xuxucode revised this gist
Aug 21, 2023 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,7 @@ 微信小程序已经内置了部分 `core-js` polyfill,但不全面。参考: - https://github.com/wechat-miniprogram/miniprogram-compat/blob/master/data/polyfill.json 需要手动打包缺失的模块,并导入项目。 ### 第一步: 以打包 `URL` 和 `URLSearchParams` 为例,运行此脚本,最后生成文件 `corejs-url.js` (139 KB) 参考文档:https://github.com/zloirock/core-js/tree/master/packages/core-js-builder -
xuxucode revised this gist
Aug 21, 2023 . 1 changed file with 0 additions and 21 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,21 +0,0 @@ -
xuxucode revised this gist
Aug 21, 2023 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,4 +17,5 @@ */ !function (undefined) { 'use strict'; /******/ (function(modules) { // webpackBootstrap // ... 省略 } -
xuxucode revised this gist
Aug 21, 2023 . No changes.There are no files selected for viewing
-
xuxucode revised this gist
Aug 21, 2023 . No changes.There are no files selected for viewing
-
xuxucode revised this gist
Aug 21, 2023 . 2 changed files with 43 additions and 37 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,37 +0,0 @@ This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ 微信小程序已经内置了部分 `core-js` polyfill,但不全面。参考: - https://github.com/wechat-miniprogram/miniprogram-compat/blob/master/data/polyfill.json - https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/js-support.html#%E6%A0%87%E5%87%86-ECMAScript-%E6%94%AF%E6%8C%81 可以通过手动打包缺失的模块,并导入项目。 ### 第一步: 以打包 `URL` 和 `URLSearchParams` 为例,运行此脚本,最后生成文件 `corejs-url.js` (139 KB) 参考文档:https://github.com/zloirock/core-js/tree/master/packages/core-js-builder ```js await builder({ // 所有需要的模块('core-js/actual/url' 包含 URL 和 URLSearchParams:https://github.com/zloirock/core-js#url-and-urlsearchparams) modules: ['core-js/actual/url'], summary: { console: { size: true, modules: true }, comment: { size: true, modules: true }, }, format: 'bundle', // 打包后的目标文件名 filename: './corejs-url.js', }) ``` ### 第二步:把 `corejs-url.js` 复制到小程序项目里,比如: ```tree ├── app.json ├── app.ts ├── lib │ └── corejs-url.js ├── pages └── utils └── util.ts ``` ### 第三步:导入 `corejs-url.js` ``` // 在 app.ts 文件 import './lib/corejs-url.js' ``` ### 备注 - 小程序开发工具(我的版本是 1.06.2307260 darwin)已经实现 `globalThis.URL` 和 `globalThis.SearchParams`,`corejs-url`**仅在真机上有效**。 -
xuxucode created this gist
Aug 21, 2023 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ // 参考文档:https://github.com/zloirock/core-js/tree/master/packages/core-js-builder // 第一步: 以打包 `URL` 和 `URLSearchParams` 为例 // 运行此脚本,最后生成文件 `corejs-url.js` await builder({ // 所有需要的模块('core-js/actual/url' 包含 URL 和 URLSearchParams:https://github.com/zloirock/core-js#url-and-urlsearchparams) modules: ['core-js/actual/url'], summary: { console: { size: true, modules: true }, comment: { size: true, modules: true }, }, format: 'bundle', // 打包后的目标文件名 filename: './corejs-url.js', }) // 第二步:把 `corejs-url.js` 复制到小程序项目里,比如: ```tree ├── app.json ├── app.ts ├── lib │ └── corejs-url.js ├── pages └── utils └── util.ts ``` // 第三步:导入 `corejs-url.js`: ``` // 在 app.ts 文件 import './lib/corejs-url.js' ``` // 备注 // 小程序开发工具(我的版本是 1.06.2307260 darwin)已经实现 `globalThis.URL` 和 `globalThis.SearchParams`,`corejs-url`仅在真机上有效。 This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ /** * core-js 3.32.1 * © 2014-2023 Denis Pushkarev (zloirock.ru) * license: https://github.com/zloirock/core-js/blob/v3.32.1/LICENSE * source: https://github.com/zloirock/core-js *//* * size: 139.40KB w/o comments *//* * modules: * web.url * web.url.can-parse * web.url.to-json * web.url-search-params * web.url-search-params.delete * web.url-search-params.has * web.url-search-params.size */ !function (undefined) { 'use strict'; /******/ (function(modules) { // webpackBootstrap // ... 省略 }