We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
我定义了一套类似于vue-router的路由配置,我写了一个插件来解析自己路由配置,动态生成小程序所需要的app.json的pages
app.json
pages
微信小程序
https://github.com/bigmeow/taro-bug-demo 小程序基础库: 无 使用框架: Vue 3
我新增了一个taro插件, 插件作用是动态修改 小程序的配置文件app.config.ts, 在插件里我给pages数组新加了一个页面,然后新加的页面并没有被编译。 插件代码:
app.config.ts
module.exports = (ctx, pluginOpts) => { ctx.modifyMiniConfigs(({ configMap }) => { console.log("动态添加app.config中的pages字段") configMap["app.config"].content.pages.push("pages/index2/index") console.log(configMap["app.config"].content.pages) }) }
重现步骤:
npm i
npm run build:weapp
打开dist/pages目录,希望看到动态新增的pages/index2/index被编译
dist/pages
pages/index2/index
编译后无pages/index2/index页面
👽 Taro v3.3.6 Taro CLI 3.3.6 environment info: System: OS: macOS 11.5.2 Shell: 5.8 - /bin/zsh Binaries: Node: 14.17.5 - ~/.nvm/versions/node/v14.17.5/bin/node Yarn: 1.22.11 - /usr/local/bin/yarn npm: 6.14.14 - ~/.nvm/versions/node/v14.17.5/bin/npm npmPackages: @tarojs/components: 3.3.6 => 3.3.6 @tarojs/mini-runner: 3.3.6 => 3.3.6 @tarojs/runtime: 3.3.6 => 3.3.6 @tarojs/taro: 3.3.6 => 3.3.6 @tarojs/webpack-runner: 3.3.6 => 3.3.6 babel-preset-taro: 3.3.6 => 3.3.6 eslint-config-taro: 3.3.6 => 3.3.6
The text was updated successfully, but these errors were encountered:
确实 modifyMiniConfigs 目前只是修改了 filesConfig,没有相应修改 this.pages。调后 modifyMiniConfigs 后,再调用一次 this.getPages() 就没问题了。
modifyMiniConfigs
filesConfig
this.pages
this.getPages()
taro/packages/taro-mini-runner/src/plugins/MiniPlugin.ts
Lines 895 to 897 in 6e3bab1
Sorry, something went wrong.
defineAppConfig
definePageConfig
No branches or pull requests
使用场景
我定义了一套类似于vue-router的路由配置,我写了一个插件来解析自己路由配置,动态生成小程序所需要的
app.json
的pages
相关平台
微信小程序
复现仓库
https://github.com/bigmeow/taro-bug-demo
小程序基础库: 无
使用框架: Vue 3
复现步骤
我新增了一个taro插件, 插件作用是动态修改 小程序的配置文件
app.config.ts
, 在插件里我给pages数组新加了一个页面,然后新加的页面并没有被编译。插件代码:
重现步骤:
npm i
npm run build:weapp
期望结果
打开
dist/pages
目录,希望看到动态新增的pages/index2/index
被编译实际结果
编译后无
pages/index2/index
页面环境信息
The text was updated successfully, but these errors were encountered: