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

Missing entries start with ^ in pages field #4

Open
fengzilong opened this issue Dec 25, 2018 · 6 comments
Open

Missing entries start with ^ in pages field #4

fengzilong opened this issue Dec 25, 2018 · 6 comments
Labels
bug Something isn't working

Comments

@fengzilong
Copy link

比如:

{
  pages: ['^pages/home/index', 'pages/logs/index'],
}

pages/home/index 无法被正确处理

@fengzilong fengzilong added the bug Something isn't working label Dec 25, 2018
@bigmeow
Copy link
Member

bigmeow commented Mar 12, 2019

这个包在这里获取了小程序的页面配置,然后返回了webpack需要的entry配置键值对,其他啥也没干,想支持^这个符号的话,得在生成app.json时去做个排序,需要你在这里处理下?
@fengzilong
https://github.com/kaola-fed/megalo-aot/blob/88d48c90856407bbe39b61600b1e3b4af2c6a556/packages/target/lib/plugins/MegaloPlugin.js

@fengzilong
Copy link
Author

fengzilong commented Mar 12, 2019

这个包是在 target 之前执行的,这个 bug target 那边处理不了

@fengzilong
Copy link
Author

换种说法,megalo-entry 生成的 entries 要传给 webpack,但是 webpack 无法识别带 ^ 的 entry,这个应该是这个包的 bug,和 target 那边没关系

@bigmeow
Copy link
Member

bigmeow commented Mar 12, 2019

我debug了下,加了^符号的不会被解析当成entries加入webpack,换句话说就是没设置entry.
唯一给webpack的,是entry里 键名为app,键值是index.js的路径
也就是说target那边拿到了这个路径,从路径里解析出了pages的页面配置,然后生成的app.json文件。
https://github.com/bigmeow/megalo-cli/blob/master/packages/%40megalo/cli-service/lib/webpack/mp/webpack.base.config.js
如图所示,加了^符号的不会出现在pages数组 里:
image

@bigmeow
Copy link
Member

bigmeow commented Mar 12, 2019

@fengzilong target那边读到配置后,能把页面动态加入entry么,现在看代码,cli这边要读一次小程序的全局页面配置,target那边又读一次,两边都要设置进去才会生效

@fengzilong
Copy link
Author

fengzilong commented Mar 12, 2019

target 处理的话,那这个包似乎没什么用了,target 那边可以通过 app 拿到所有的 pages

我们微信沟通吧,加你了,这里效率有点低...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants