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

feat: add new mixin loadCustomLoader in Loader #202

Merged
merged 6 commits into from
Mar 6, 2019
Merged

Conversation

popomore
Copy link
Member

@popomore popomore commented Feb 28, 2019

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)
Description of change

@fengmk2
Copy link
Member

fengmk2 commented Feb 28, 2019

太需要这个功能了!文档也得一起写上。

module.exports = {
customLoader: {
adapter: {
directory: 'app/adapter',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还得支持 filter,例如过滤 _ 开始的文件(如 _foo.js 不希望被加载)。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

支持的,直接传递 loader 那个 options 进去就好了

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

所以需要文档。。。

Copy link
Member

@atian25 atian25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

const defaultConfig = {
caseStyle: 'lower',
initializer(Class) {
return new Class(loader.app);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果 load 的是 app/ultis 这种 exports 方式的,会不会有问题

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

默认加载 class,其他的通过配置的方式。

lib/loader/mixin/custom_loader.js Show resolved Hide resolved
@whxaxes
Copy link
Member

whxaxes commented Mar 1, 2019

文档也补充一下呗,其他 lgtm

@popomore
Copy link
Member Author

popomore commented Mar 1, 2019

文档在这里 eggjs/egg#3484

@atian25
Copy link
Member

atian25 commented Mar 1, 2019

+1 发吧

@popomore
Copy link
Member Author

popomore commented Mar 6, 2019

没问题我先发一版

@popomore popomore merged commit 3299be4 into master Mar 6, 2019
@popomore popomore deleted the custom-loader branch March 6, 2019 10:25
@popomore
Copy link
Member Author

popomore commented Mar 6, 2019

@popomore popomore mentioned this pull request Mar 6, 2019
7 tasks
hyj1991 pushed a commit to hyj1991/egg-core that referenced this pull request Sep 16, 2021
<!--
Thank you for your pull request. Please review below requirements.
Bug fixes and new features should include tests and possibly benchmarks.
Contributors guide: https://github.com/eggjs/egg/blob/master/CONTRIBUTING.md

感谢您贡献代码。请确认下列 checklist 的完成情况。
Bug 修复和新功能必须包含测试,必要时请附上性能测试。
Contributors guide: https://github.com/eggjs/egg/blob/master/CONTRIBUTING.md
-->

##### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [x] `npm test` passes
- [x] tests and/or benchmarks are included
- [x] documentation is changed or added
- [x] commit message follows commit guidelines

##### Affected core subsystem(s)
<!-- Provide affected core subsystem(s). -->


##### Description of change
<!-- Provide a description of the change below this comment. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants