From 08ba50ae10ba024b52617586cb769b1ae4f29872 Mon Sep 17 00:00:00 2001 From: singlecoder Date: Wed, 20 Nov 2024 18:05:15 +0800 Subject: [PATCH] Delete mini program (#2433) * feat(platform-adapter): delete mini * doc(platform-adapter): delete doc for miniprogram --- .gitignore | 1 - README.md | 2 +- docs/en/_meta.json | 6 - docs/en/assets/build.md | 4 - docs/en/basics/overview.md | 2 +- docs/en/miniProgram/miniProgame.md | 241 ----------------------------- docs/zh/_meta.json | 6 - docs/zh/assets/build.md | 3 - docs/zh/basics/overview.md | 2 +- docs/zh/miniProgram/miniProgame.md | 240 ---------------------------- package.json | 1 - packages/galacean/README.md | 2 +- rollup.config.js | 30 +--- rollup.miniprogram.plugin.js | 65 -------- 14 files changed, 5 insertions(+), 600 deletions(-) delete mode 100644 docs/en/miniProgram/miniProgame.md delete mode 100644 docs/zh/miniProgram/miniProgame.md delete mode 100644 rollup.miniprogram.plugin.js diff --git a/.gitignore b/.gitignore index f9445f32a5..98e700233a 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ types /boilerplates/*/node_modules lib dist -dist-miniprogram coverage .nyc_output npm-debug.log* diff --git a/README.md b/README.md index 2ec72f6d37..10aeec038e 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ ## Features -- 🖥  **Platform** - Support HTML5 and Alipay miniprogram +- 🖥  **Platform** - Support HTML5 and wechat minigame - 🔮  **Graphics** - Advanced 2D + 3D graphics engine - 🏃  **Animation** - Powerful animation system - 🧱  **Physics** - Powerful and easy-to-use physical features diff --git a/docs/en/_meta.json b/docs/en/_meta.json index 5676f534e1..5843b8920f 100644 --- a/docs/en/_meta.json +++ b/docs/en/_meta.json @@ -71,12 +71,6 @@ "collapse": true } }, - "miniProgram": { - "title": "Mini Program", - "theme": { - "collapse": true - } - }, "art": { "title": "Art", "theme": { diff --git a/docs/en/assets/build.md b/docs/en/assets/build.md index ded85214cc..664f0a2573 100644 --- a/docs/en/assets/build.md +++ b/docs/en/assets/build.md @@ -89,7 +89,3 @@ Then visit the corresponding address: image-20231008163057689 > The exported project is a vite project. For more deployment solutions, refer to [vite official website](https://vitejs.dev/guide/) - -## Mini Program Project - -Please refer to [Mini Program Project](/en/docs/miniProgram/miniProgame/) diff --git a/docs/en/basics/overview.md b/docs/en/basics/overview.md index 49477e12e4..8e440e88db 100644 --- a/docs/en/basics/overview.md +++ b/docs/en/basics/overview.md @@ -81,7 +81,7 @@ There are also some secondary ecosystem packages, which are introduced and used Galacean Runtime runs in environments that support WebGL. So far, all major mobile and desktop browsers support this standard. You can check the compatibility of the runtime environment on [CanIUse](https://caniuse.com/?search=webgl). -In addition, **Galacean Runtime** also supports running in [Alipay/Taobao Mini Programs](/en/docs/assets/build), and developers in the community have contributed [WeChat Mini Programs/Game adaptation solutions](https://github.com/deepkolos/platformize). For some functional modules that require additional compatibility considerations, the current adaptation solutions are as follows: +For some functional modules that require additional compatibility considerations, the current adaptation solutions are as follows: | Module | Compatibility Considerations | Specific Documentation | | :-- | :-- | :-- | diff --git a/docs/en/miniProgram/miniProgame.md b/docs/en/miniProgram/miniProgame.md deleted file mode 100644 index 3c89cfbe80..0000000000 --- a/docs/en/miniProgram/miniProgame.md +++ /dev/null @@ -1,241 +0,0 @@ ---- -order: 0 -title: MiniProgram Project -type: MiniProgram -label: MiniProgram ---- - -Currently, Galacean has been adapted to Alipay and Taobao Mini Programs. This tutorial assumes that developers already have some Mini Program development skills. If not, please read the following tutorials, download the Mini Program development tools, and apply for an AppId: - -- [Alipay Mini Program](https://opendocs.alipay.com/mini/developer) -- [Taobao Mini Program](https://miniapp.open.taobao.com/docV3.htm?docId=119114&docType=1&tag=dev) - -Mini Program project release: - -- [Alipay Mini Program Release](https://opendocs.alipay.com/mini/introduce/release) -- [Taobao Mini Program Release](https://developer.alibaba.com/docs/doc.htm?spm=a219a.7629140.0.0.258775fexQgSFj&treeId=635&articleId=117321&docType=1) - -## Project Export - -The feature to export Alipay Mini Programs from the Galacean editor is still under development, and the interaction methods and template projects may change in the future. - -image-20231008163057689 - -## Project Startup - -After clicking download, a zip file will be downloaded. The directory structure after unzipping is as follows: - -```shell -. -├── mini # 📁 小程序执行目录 -│ ├── dist # 📁 代码构建结果 -│ ├── pages # 📁 小程序页面 -│ ├── app.json # ⚙️ 项目配置文件 -│ ├── app.js # 代码入口 -├── public # 📁 公共资源目录 -│ ├── scene.json # 场景文件 -│ └── ... # 其他 -├── src # 📁 源代码目录 -├── mini.project.json # ⚙️ 工程配置文件 -├── project.json # ⚙️ 编辑器导出工程配置 -└── ... # 其他 -``` - -Next, you can install dependencies and start the project: - -```shell -npm install -npm run dev -``` - -Opening it with the Mini Program IDE, you can see: - -![image-20230420111035524](https://mdn.alipayobjects.com/rms/afts/img/A*kEUkTbfSMIwAAAAAAAAAAAAAARQnAQ/original/image-20230420111035524.png) - -## Local Resource Handling - -### Ant Group Internal Users - -Directly use "Upload to CDN" (in the export panel options, refer to the image above), using the default CDN of the group. If you want to use a custom CDN, refer to the instructions for non-Ant Group internal users. - -### Non-Ant Group Internal Users - -1. Upload the public files to the CDN yourself. -2. Modify the scene.json file or configure the baseUrl. - -## In-Package File Loading (WIP) - -Currently, local file loading for Mini Programs is not supported. - -## Known Issues - -- Mini Programs do not support WebAssembly, so PhysX cannot be used as the physics backend. -- Local file loading is not supported yet, and files need to be manually uploaded to the CDN. - -## Additional Notes - -### Using OrbitControl in Mini Program Projects - -1. Import the library - -```bash -npm install @galacean/engine-toolkit-controls -S -``` - -```typescript -import { OrbitControl } from "@galacean/engine-toolkit-controls/dist/miniprogram"; -``` - -2. Add the component - -The `OrbitControl` component needs to be added to the camera node. - -```typescript -cameraEntity.addComponent(OrbitControl); -``` - -3. Simulate event dispatch - -Since Mini Programs do not support `addEventListener` for adding event listeners, you need to manually add event simulation. Additionally, there is a bug with multi-touch on the Mini Program canvas, so add a view layer of the same size and position as the canvas to dispatch touch events: - -```html - - - - - -``` - -```typescript -import { dispatchPointerUp, dispatchPointerDown, dispatchPointerMove, dispatchPointerLeave, dispatchPointerCancel } from "@galacean/engine-miniprogram-adapter"; - -Page({ - ... - onTouchEnd(e) { - dispatchPointerUp(e); - dispatchPointerLeave(e); - }, - onTouchStart(e) { - dispatchPointerDown(e); - }, - onTouchMove(e) { - dispatchPointerMove(e); - }, - onTouchCancel(e) { - dispatchPointerCancel(e); - } -}) -``` - -### Creating a Galacean Mini Program Project with Pro Code - -> Requires Node.js version >=12.0.0. - -Using yarn to create - -```bash -yarn create @galacean/galacean-app --template miniprogram -``` - -Using npm **6.x** version to create - -``` -npm init @galacean/galacean-app --template miniprogram -``` - -Using npm **7.x** version to create - -```she -npm init @galacean/galacean-app -- --template miniprogram -``` - -**Follow the prompts** to complete the subsequent steps, then you can use the mini program development tool to open the project: - -![image-20210609164550721](https://gw.alipayobjects.com/zos/OasisHub/3e2df40f-6ccd-4442-85f8-69233d04b3b5/image-20210609164550721.png) - -Select the corresponding directory, and if everything goes well, you should see: - -![image-20210609164816776](https://gw.alipayobjects.com/zos/OasisHub/04386e9c-b882-41f7-8aa6-a1bf990d578b/image-20210609164816776.png) - -### Using Galacean in an existing Pro code project - -This tutorial assumes you already have some development skills. If you are not familiar with mini program development, please read the [mini program development documentation](https://opendocs.alipay.com/mini/developer) in detail. - -1. Open `Terminal` in the project directory and install dependencies: - -```bash -# 使用 npm -npm install @galacean/engine --save -npm install @galacean/engine-miniprogram-adapter --save -# 使用 yarn -yarn add @galacean/engine -yarn add @galacean/engine-miniprogram-adapter -``` - -2. Add the following configuration items to the mini program project configuration file `app.json`: - -```json -{ - ... - "window": { - ... - "v8WorkerPlugins": "gcanvas_runtime", - "v8Worker": 1, - "enableSkia": "true" - } -} -``` - -3. Add a canvas tag to the axml page where you want to add interaction: - -```html - -``` - -Use the `onReady` configuration to set up the `canvas` initialization callback. You need to set the `canvas` id, which will be used later. - -4. Add a callback function in the `.js` code file of the page, use `my._createCanvas` to create the required canvas context, and then use galacean in the `success` callback. - -Note: - -1. Use `import * as GALACEAN from "@galacean/engine/dist/miniprogram"` to import mini program dependencies. -2. You need to use `registerCanvas` from '@galacean/engine-miniprogram-adapter' to register the `canvas`. - -For details, you can refer to the following code: - -```js -import * as GALACEAN from "@galacean/engine/dist/miniprogram"; -import { registerCanvas } from "@galacean/engine-miniprogram-adapter"; - -Page({ - onCanvasReady() { - my._createCanvas({ - id: "canvas", - success: (canvas) => { - // 注册 canvas - registerCanvas(canvas); - // 适配 canvas 大小 - const info = my.getSystemInfoSync(); - const { windowWidth, windowHeight, pixelRatio, titleBarHeight } = info; - canvas.width = windowWidth * pixelRatio; - canvas.height = (windowHeight - titleBarHeight) * pixelRatio; - - // 创建引擎 - const engine = new GALACEAN.WebGLEngine(canvas); - // 剩余代码和 Galacean Web 版本一致 - ... - }, - }); - } -}) -``` -``` diff --git a/docs/zh/_meta.json b/docs/zh/_meta.json index fd7a148288..d5b6fdd280 100644 --- a/docs/zh/_meta.json +++ b/docs/zh/_meta.json @@ -71,12 +71,6 @@ "collapse": true } }, - "miniProgram": { - "title": "小程序", - "theme": { - "collapse": true - } - }, "art": { "title": "美术", "theme": { diff --git a/docs/zh/assets/build.md b/docs/zh/assets/build.md index fd2efae149..6346de0b41 100644 --- a/docs/zh/assets/build.md +++ b/docs/zh/assets/build.md @@ -90,6 +90,3 @@ npm run build > 导出项目为 vite 工程,更多部署方案参考 [vite 官网](https://vitejs.dev/guide/) -## 小程序项目 - -请参照 [小程序项目](/docs/miniProgram/miniProgame/) \ No newline at end of file diff --git a/docs/zh/basics/overview.md b/docs/zh/basics/overview.md index 0225340a88..ef18e456f1 100644 --- a/docs/zh/basics/overview.md +++ b/docs/zh/basics/overview.md @@ -81,7 +81,7 @@ import { WebGLEngine, Camera } from "@galacean/engine"; Galacean Runtime 在支持 WebGL 的环境下运行,到目前为止,所有主流的移动端浏览器与桌面浏览器都支持这一标准。可以在 [CanIUse](https://caniuse.com/?search=webgl) 上检测运行环境的兼容性。 -此外,**Galacean Runtime** 还支持在[支付宝/淘宝小程序](/docs/miniProgram/miniProgame/)中运行,同时也有开发者在社区贡献了[微信小程序/游戏的适配方案](https://github.com/deepkolos/platformize)。对于一些需要额外考虑兼容性的功能模块,当前的适配方案如下: +对于一些需要额外考虑兼容性的功能模块,当前的适配方案如下: | 模块 | 兼容考虑 | 具体文档 | | :-- | :-- | :-- | diff --git a/docs/zh/miniProgram/miniProgame.md b/docs/zh/miniProgram/miniProgame.md deleted file mode 100644 index 8141244547..0000000000 --- a/docs/zh/miniProgram/miniProgame.md +++ /dev/null @@ -1,240 +0,0 @@ ---- -order: 0 -title: 小程序项目 -type: 小程序 -label: MiniProgram ---- - -目前 Galacean 已经适配到支付宝和淘宝小程序。本教程默认开发者已经具备一定的小程序开发能力,如果没有,请阅读下面教程,下载小程序开发工具及申请 AppId: - -- [支付宝小程序](https://opendocs.alipay.com/mini/developer) -- [淘宝小程序](https://miniapp.open.taobao.com/docV3.htm?docId=119114&docType=1&tag=dev) - -小程序项目发布: - -- [支付宝小程序发布](https://opendocs.alipay.com/mini/introduce/release) -- [淘宝小程序发布](https://developer.alibaba.com/docs/doc.htm?spm=a219a.7629140.0.0.258775fexQgSFj&treeId=635&articleId=117321&docType=1) - -## 项目导出 - -Galacean 编辑器导出支付宝小程序的功能仍在开发中,交互方式和模板工程后续可能会有改动。 - -image-20231008163057689 - -## 项目启动 - -点击下载后会下载一个 zip 文件,解压文件目录结构如下: - -```shell -. -├── mini # 📁 小程序执行目录 -│ ├── dist # 📁 代码构建结果 -│ ├── pages # 📁 小程序页面 -│ ├── app.json # ⚙️ 项目配置文件 -│ ├── app.js # 代码入口 -├── public # 📁 公共资源目录 -│ ├── scene.json # 场景文件 -│ └── ... # 其他 -├── src # 📁 源代码目录 -├── mini.project.json # ⚙️ 工程配置文件 -├── project.json # ⚙️ 编辑器导出工程配置 -└── ... # 其他 -``` - -接下来就可以安装依赖和启动项目: - -```shell -npm install -npm run dev -``` - -用小程序 IDE 打开可以看到: - -![image-20230420111035524](https://mdn.alipayobjects.com/rms/afts/img/A*kEUkTbfSMIwAAAAAAAAAAAAAARQnAQ/original/image-20230420111035524.png) - -## 本地资源处理 - -### 蚂蚁集团内部用户 - -直接使用『上传到 CDN 』即可(在导出面板选项中,参考上图),使用集团默认 CDN 即可。若想使用自定义 CDN,参考非蚂蚁集团内部用户。 - -### 非蚂蚁集团内部用户 - -1. public 文件请自行上传 CDN -2. 修改 scene.json 文件或配置 baseUrl - -## 包内文件加载(WIP) - -目前还没有支持小程序的本地文件加载。 - -## 已知问题 - -- 小程序不支持 WebAssembly,目前无法使用 PhysX 作为物理后端 -- 目前不支持本地文件加载,需要手动上传到 CDN - -## 补充说明 - -### 小程序项目使用 OrbitControl - -1. 引入二方库 - -```bash -npm install @galacean/engine-toolkit-controls -S -``` - -```typescript -import { OrbitControl } from "@galacean/engine-toolkit-controls/dist/miniprogram"; -``` - -2. 添加组件 - -`OrbitControl` 组件需要添加到相机节点上。 - -```typescript -cameraEntity.addComponent(OrbitControl); -``` - -3. 事件模拟派发 - -因为小程序不支持 `addEventListener` 添加监听事件,得手动添加事件的模拟,并且小程序的 canvas 的多指触控存在 bug,所以添加一个和 canvas 大小和位置一样的 view 层去派发触摸事件: - -```html - - - - - -``` - -```typescript -import { dispatchPointerUp, dispatchPointerDown, dispatchPointerMove, dispatchPointerLeave, dispatchPointerCancel } from "@galacean/engine-miniprogram-adapter"; - -Page({ - ... - onTouchEnd(e) { - dispatchPointerUp(e); - dispatchPointerLeave(e); - }, - onTouchStart(e) { - dispatchPointerDown(e); - }, - onTouchMove(e) { - dispatchPointerMove(e); - }, - onTouchCancel(e) { - dispatchPointerCancel(e); - } -}) -``` - -### Pro code 创建 Galacean 小程序项目 - -> 需要 Node.js 版本 >=12.0.0. - -使用 yarn 创建 - -```bash -yarn create @galacean/galacean-app --template miniprogram -``` - -使用 npm **6.x** 版本创建 - -``` -npm init @galacean/galacean-app --template miniprogram -``` - -使用 npm **7.x** 版本创建 - -```she -npm init @galacean/galacean-app -- --template miniprogram -``` - -**根据提示**完成后续步骤后,可以使用小程序开发工具打开项目: - -![image-20210609164550721](https://gw.alipayobjects.com/zos/OasisHub/3e2df40f-6ccd-4442-85f8-69233d04b3b5/image-20210609164550721.png) - -选择对应目录即可,顺利的话可以看到: - -![image-20210609164816776](https://gw.alipayobjects.com/zos/OasisHub/04386e9c-b882-41f7-8aa6-a1bf990d578b/image-20210609164816776.png) - -### 已有项目 Pro code 使用 Galacean - -本教程假设你已经有一定开发能力,若不熟悉小程序开发,请详细阅读[小程序开发文档](https://opendocs.alipay.com/mini/developer)。 - -1. 在项目目录中打开 `Terminal`,安装依赖: - -```bash -# 使用 npm -npm install @galacean/engine --save -npm install @galacean/engine-miniprogram-adapter --save -# 使用 yarn -yarn add @galacean/engine -yarn add @galacean/engine-miniprogram-adapter -``` - -2. 在小程序项目配置文件 `app.json` 里添加下面配置项: - -```json -{ - ... - "window": { - ... - "v8WorkerPlugins": "gcanvas_runtime", - "v8Worker": 1, - "enableSkia": "true" - } -} -``` - -3. 在需要添加互动的 axml 页面里加入 canvas 标签 - -```html - -``` - -使用 `onReady` 配置 `canvas` 初始化回调。需要设置 `canvas` 的 id,后面会用到。 - -4. 在页面的 `.js` 代码文件里添加回调函数,使用 `my._createCanvas` 创建所需的 canvas 上下文,之后在 `success` 回调里使用 galacean 即可. - -注意: - -1. 使用 `import * as GALACEAN from "@galacean/engine/dist/miniprogram"` 引入小程序依赖。 -2. 需要使用『@galacean/engine-miniprogram-adapter』里的 `registerCanvas` 注册 `canvas`。 - -详情可以参考下面代码: - -```js -import * as GALACEAN from "@galacean/engine/dist/miniprogram"; -import { registerCanvas } from "@galacean/engine-miniprogram-adapter"; - -Page({ - onCanvasReady() { - my._createCanvas({ - id: "canvas", - success: (canvas) => { - // 注册 canvas - registerCanvas(canvas); - // 适配 canvas 大小 - const info = my.getSystemInfoSync(); - const { windowWidth, windowHeight, pixelRatio, titleBarHeight } = info; - canvas.width = windowWidth * pixelRatio; - canvas.height = (windowHeight - titleBarHeight) * pixelRatio; - - // 创建引擎 - const engine = new GALACEAN.WebGLEngine(canvas); - // 剩余代码和 Galacean Web 版本一致 - ... - }, - }); - } -}) -``` diff --git a/package.json b/package.json index faf4de19a4..71752b21aa 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ "b:types": "pnpm -r --filter=./packages/* run b:types", "b:module": "cross-env BUILD_TYPE=MODULE NODE_ENV=release rollup -c", "b:umd": "cross-env BUILD_TYPE=UMD NODE_ENV=release rollup -c", - "b:miniprogram": "cross-env BUILD_TYPE=MINI rollup -c", "b:all": "cross-env NODE_ENV=release npm run b:types && cross-env BUILD_TYPE=ALL NODE_ENV=release rollup -c", "clean": "pnpm -r exec rm -rf dist && pnpm -r exec rm -rf types", "e2e:case": "pnpm -C ./e2e run case", diff --git a/packages/galacean/README.md b/packages/galacean/README.md index be4d024d9e..71bc59c556 100644 --- a/packages/galacean/README.md +++ b/packages/galacean/README.md @@ -9,7 +9,7 @@ Galacean is a **web-first** and **mobile-first** high-performance real-time inte ## Features -- 🖥  **Platform** - Suppport HTML5 and Alipay miniprogram +- 🖥  **Platform** - Suppport HTML5 and wechat minigame - 🔮  **Graphics** - Advanced 2D + 3D graphics engine - 🏃  **Animation** - Powerful animation system - 🧱  **Physics** - Powerful and easy-to-use physical features diff --git a/rollup.config.js b/rollup.config.js index ad02bf0645..c253121a51 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -5,7 +5,6 @@ import resolve from "@rollup/plugin-node-resolve"; import commonjs from "@rollup/plugin-commonjs"; import glslify from "rollup-plugin-glslify"; import serve from "rollup-plugin-serve"; -import miniProgramPlugin from "./rollup.miniprogram.plugin"; import replace from "@rollup/plugin-replace"; import { swc, defineRollupSwcOption, minify } from "rollup-plugin-swc3"; import jscc from "rollup-plugin-jscc"; @@ -116,25 +115,6 @@ function config({ location, pkgJson, verboseMode }) { plugins: curPlugins }; }, - mini: () => { - let file = path.join(location, "dist", "miniprogram.js"); - const plugins = [...curPlugins, ...miniProgramPlugin]; - if (verboseMode) { - file = path.join(location, "dist", "miniprogram.verbose.js"); - } - return { - input, - output: [ - { - format: "cjs", - file, - sourcemap: false - } - ], - external: external.concat("@galacean/engine-miniprogram-adapter").map((name) => `${name}/dist/miniprogram`), - plugins - }; - }, module: () => { let esFile = path.join(location, pkgJson.module); let mainFile = path.join(location, pkgJson.main); @@ -176,9 +156,6 @@ switch (BUILD_TYPE) { case "MODULE": promises.push(...getModule()); break; - case "MINI": - promises.push(...getMini()); - break; case "ALL": promises.push(...getAll()); break; @@ -207,13 +184,8 @@ function getModule() { return configs.map((config) => makeRollupConfig({ ...config, type: "module" })); } -function getMini() { - const configs = [...pkgs]; - return configs.map((config) => makeRollupConfig({ ...config, type: "mini" })); -} - function getAll() { - return [...getModule(), ...getMini(), ...getUMD()]; + return [...getModule(), ...getUMD()]; } export default Promise.all(promises); diff --git a/rollup.miniprogram.plugin.js b/rollup.miniprogram.plugin.js deleted file mode 100644 index a5ba763230..0000000000 --- a/rollup.miniprogram.plugin.js +++ /dev/null @@ -1,65 +0,0 @@ -import inject from "@rollup/plugin-inject"; -import modify from "rollup-plugin-modify"; -const fs = require("fs"); -const path = require("path"); - -const module = "@galacean/engine-miniprogram-adapter"; - -function register(name) { - return [module, name]; -} - -const adapterArray = [ - "btoa", - "URL", - "Blob", - "window", - "atob", - "devicePixelRatio", - "document", - "Element", - "Event", - "EventTarget", - "HTMLCanvasElement", - "HTMLElement", - "HTMLMediaElement", - "HTMLVideoElement", - "Image", - "navigator", - "Node", - "requestAnimationFrame", - "cancelAnimationFrame", - "screen", - "XMLHttpRequest", - "performance", - "WebGLRenderingContext", - "WebGL2RenderingContext", - "ImageData", - "location", - "OffscreenCanvas", - "URLSearchParams" -]; -const adapterVars = {}; - -adapterArray.forEach((name) => { - adapterVars[name] = register(name); -}); - -const packages = fs - .readdirSync(path.join(__dirname, "packages")) - .map((dir) => path.join("packages", dir, `package.json`)) - .map((pkgPath) => require(path.join(__dirname, pkgPath))) - .map((pkg) => pkg.name) - .map((name) => `"${name}"`); - -const regStr = packages.join("|"); - -export default [ - inject(adapterVars), - modify({ - find: new RegExp(regStr, "g"), - replace: (match, moduleName) => { - return `${match.substr(0, match.length - 1)}/dist/miniprogram"`; - } - }) -];